Creates a new decorator using the specified {@link ThrottlingStrategy} instance.

@param strategy The {@link ThrottlingStrategy} instance to be used
482318
public static Function<Service<RpcRequest, RpcResponse>, ThrottlingRpcService>
    newDecorator(ThrottlingStrategy<RpcRequest> strategy) {
        requireNonNull(strategy, "strategy");
        return delegate -> new ThrottlingRpcService(delegate, strategy);
    }
121667
public function setSaveStrategy($strategy)
    {
        if (!in_array($strategy, [self::SAVE_APPEND, self::SAVE_REPLACE])) {
            $msg = sprintf('Invalid save strategy "%s"', $strategy);
            throw new InvalidArgumentException($msg);
        }

        $this->_saveStrategy = $strategy;

        return $this;
    }
984707
public Retryer<R> withBlockStrategy(BlockStrategy blockStrategy) {
        checkState(this.blockStrategy == null, "a block strategy has already been set %s", this.blockStrategy);
        this.blockStrategy = checkNotNull(blockStrategy, "BlockStrategy cannot be null");
        return this;
    }
988302
public void selectStrategy() {
		LightweightTypeReference expectedType = expectation.getExpectedType();
		if (expectedType == null) {
			strategy = getClosureWithoutExpectationHelper();
		} else {
			JvmOperation operation = functionTypes.findImplementingOperation(expectedType);
			JvmType type = expectedType.getType();
			int closureParameterSize;
			if (closure.isExplicitSyntax()) {
				closureParameterSize = closure.getDeclaredFormalParameters().size();
			} else if (operation != null) {
				closureParameterSize = operation.getParameters().size();
			} else {
				closureParameterSize = 1;
			}
			if (operation == null || operation.getParameters().size() != closureParameterSize || type == null) {
				strategy = getClosureWithoutExpectationHelper();
			} else {
				strategy = createClosureWithExpectationHelper(operation);
			}
		}
		
	}
503016
public function register($name, AuthStrategy $strategy)
    {
        if($this->getOrNull($name)) {
            throw new StrategyAlreadyRegisteredException;
        };

        $this->strategies[$name] = $strategy;

        return $this;
    }
495969
function applyEventStrategy(strategy, event) {
  const request = event.request;
  switch (strategy.type) {
    case 'offline-only':
      return fetchAndCache(request, strategy)().catch(getFromCache(request));
    case 'fallback-only':
      return fetchAndCache(request, strategy)().then(fallbackToCache(request));
    case 'prefer-cache':
      return getFromCache(request)().catch(fetchAndCache(request, strategy));
    case 'race':
      return getFromFastest(request, strategy)();
    default:
      return Promise.reject(`Strategy not supported: ${strategy.type}`);
  }
}
632800
public function createStrategy($strategy_type)
	{
		if ( $strategy_type == ISessionStrategyFactory::TYPE_ISOLATED ) {
			return $this->application->getObject('isolated_session_strategy');
		}
		elseif ( $strategy_type == ISessionStrategyFactory::TYPE_SHARED ) {
			return $this->application->getObject('shared_session_strategy');
		}

		throw new \InvalidArgumentException('Incorrect session strategy type');
	}
1114972
public void setStrategy( double median,
                             double standardDeviation,
                             int sigma ) {
        this.bucketingStrategy = new StandardDeviationBucketingStrategy(median, standardDeviation, sigma);
        this.bucketWidth = null;
    }
678288
function OAuth2Strategy (provider, client, verify) {
  Strategy.call(this)
  this.provider = provider
  this.endpoints = provider.endpoints
  this.mapping = provider.mapping
  this.client = client
  this.name = provider.id
  this.verify = verify
}
948989
function Strategy(name, user) {
  if (!name || name.length === 0) { throw new TypeError('DevStrategy requires a Strategy name') ; }

  passport.Strategy.call(this);
  this.name = name;
  this._user = user;
}
1012705
public static <T, S extends Sequence<S>> List<Cluster<T>> performClustering(Collection<T> inputObjects,
                                                                                SequenceExtractor<T, S> sequenceExtractor,
                                                                                ClusteringStrategy<T, S> strategy) {
        return new Clustering<>(inputObjects, sequenceExtractor, strategy).performClustering();
    }
1193164
protected function buildCountableStrategies()
    {
        foreach ($this->countStrategies as &$strategy) {

            // check if the strategy is a string that should be instantiated as a class
            if (is_string($strategy)) {

                try {

                    $reflection = new ReflectionClass($strategy);

                    if ( ! $reflection->isInstantiable()) {
                        throw new ParameterStrategyInvalidException("Uninstantiable string provided as countStrategy for '{$strategy}'");
                    }

                    $strategy = new $strategy();

                } catch (\Exception $e) {

                    throw new ParameterStrategyInvalidException(
                        "Exception thrown while trying to reflect or instantiate string provided as countStrategy for '{$strategy}'",
                        0, $e
                    );
                }

                // check if it is of the correct type
                if ( ! is_a($strategy, ParameterCounterInterface::class)) {

                    throw new ParameterStrategyInvalidException(
                        "Instantiated string provided is not a ParameterFilter: '" . get_class($strategy) . "'"
                    );
                }
            }
        }

        unset($strategy);

        return $this->countStrategies;
    }
798356
function Strategy(transports, options) {
  var strategy = this;

  if (!(strategy instanceof Strategy)) return new Strategy(transports, options);
  if (Object.prototype.toString.call(transports) !== '[object Array]') {
    options = transports;
    transports = [];
  }

  strategy.transports = [];     // List of active transports.
  strategy.transport = 0;       // Current selected transport id.
  strategy.length = 0;          // Amount of transports available.
  strategy.id = 0;              // ID generation pool.

  for (var i = 0; i < transports.length; i++) {
    strategy.push(transports[i]);
  }
}
753737
@Override
	public <T extends Endpoint> Strategy<T> create() {
		if (transporter == null) {
			return new RoundRobinStrategy<T>(broker, preferLocal);
		}
		return new NetworkLatencyStrategy<T>(broker, preferLocal, maxTries, this);
	}
299675
@Bean
	@ConditionalOnMissingBean(CacheStrategy.class)
	@Order(-90)
	<K, V> CacheStrategy<K, V> defaultCacheStrategy() {
		LOGGER.debug("Creating cache strategy 'LruMemoryCacheStrategy'");
		return new LruMemoryCacheStrategy<>();
	}
533548
function Strategy(options, keying, verify) {
  if (typeof options === 'function') {
    verify = keying;
    keying = options;
    options = undefined;
  }
  options = options || {};

  var audience = options.audience;

  if (!audience) {
    throw new TypeError('OAuth 2.0 JWT bearer strategy requires an audience option');
  }
  if (!keying) {
    throw new TypeError('OAuth 2.0 JWT bearer strategy requires a keying callback');
  }
  if (!verify) {
    throw new TypeError('OAuth 2.0 JWT bearer strategy requires a verify callback');
  }

  if (!Array.isArray(audience)) {
    audience = [ audience ];
  }

  passport.Strategy.call(this);
  this.name = 'oauth2-jwt-bearer';
  this._audience = audience;
  this._keying = keying;
  this._verify = verify;
  this.jwtAlgorithm = options.jwtAlgorithm || 'RS256';

  this._passReqToCallback = options.passReqToCallback;
}
563230
function Strategy(options, verify) {

  if (typeof options != 'object') options = {};

  if (!options.secretOrPublicKey) throw new TypeError(
    'JwtCookieComboStrategy requires a secret or public key'
  );

  if (!verify) throw new TypeError(
    'JwtCookieComboStrategy requires a verify callback'
  );

  passport.Strategy.call(this);

  this.name = 'jwt-cookiecombo';
  this._verify = verify;

  this._jwtVerifyOptions = Object.assign({}, options.jwtVerifyOptions);
  this._passReqToCallback = options.passReqToCallback || false;
  this._jwtHeaderKey = options.jwtHeaderKey || 'authorization';
  this._jwtCookieName = options.jwtCookieName || 'jwt';
  this._jwtCookieSecure = options.jwtCookieSecure !== false;
  this._secretOrPublicKey = options.secretOrPublicKey;

  this._jwtHeaderKey = this._jwtHeaderKey.toLowerCase();

}