Tabnine Logo
HystrixRequestVariable
Code IndexAdd Tabnine to your IDE (free)

How to use
HystrixRequestVariable
in
com.netflix.hystrix.strategy.concurrency

Best Java code snippets using com.netflix.hystrix.strategy.concurrency.HystrixRequestVariable (Showing top 2 results out of 315)

origin: PipelineAI/pipeline

@SuppressWarnings("unchecked")
public T get(HystrixConcurrencyStrategy concurrencyStrategy) {
  /*
   * 1) Fetch RequestVariable implementation from cache.
   * 2) If no implementation is found in cache then construct from factory.
   * 3) Cache implementation from factory as each object instance needs to be statically cached to be relevant across threads.
   */
  RVCacheKey key = new RVCacheKey(this, concurrencyStrategy);
  HystrixRequestVariable<?> rvInstance = requestVariableInstance.get(key);
  if (rvInstance == null) {
    requestVariableInstance.putIfAbsent(key, concurrencyStrategy.getRequestVariable(lifeCycleMethods));
    /*
     * A safety check to help debug problems if someone starts injecting dynamically created HystrixConcurrencyStrategy instances - which should not be done and has no good reason to be done.
     * 
     * The 100 value is arbitrary ... just a number far higher than we should see.
     */
    if (requestVariableInstance.size() > 100) {
      logger.warn("Over 100 instances of HystrixRequestVariable are being stored. This is likely the sign of a memory leak caused by using unique instances of HystrixConcurrencyStrategy instead of a single instance.");
    }
  }
  return (T) requestVariableInstance.get(key).get();
}
origin: com.netflix.hystrix/hystrix-core

@SuppressWarnings("unchecked")
public T get(HystrixConcurrencyStrategy concurrencyStrategy) {
  /*
   * 1) Fetch RequestVariable implementation from cache.
   * 2) If no implementation is found in cache then construct from factory.
   * 3) Cache implementation from factory as each object instance needs to be statically cached to be relevant across threads.
   */
  RVCacheKey key = new RVCacheKey(this, concurrencyStrategy);
  HystrixRequestVariable<?> rvInstance = requestVariableInstance.get(key);
  if (rvInstance == null) {
    requestVariableInstance.putIfAbsent(key, concurrencyStrategy.getRequestVariable(lifeCycleMethods));
    /*
     * A safety check to help debug problems if someone starts injecting dynamically created HystrixConcurrencyStrategy instances - which should not be done and has no good reason to be done.
     * 
     * The 100 value is arbitrary ... just a number far higher than we should see.
     */
    if (requestVariableInstance.size() > 100) {
      logger.warn("Over 100 instances of HystrixRequestVariable are being stored. This is likely the sign of a memory leak caused by using unique instances of HystrixConcurrencyStrategy instead of a single instance.");
    }
  }
  return (T) requestVariableInstance.get(key).get();
}
com.netflix.hystrix.strategy.concurrencyHystrixRequestVariable

Javadoc

Interface for a variable similar to ThreadLocal but scoped at the user request level.

Default implementation is HystrixRequestVariableDefault managed by HystrixRequestContext.

Custom implementations can be injected using HystrixPlugins and HystrixConcurrencyStrategy#getRequestVariable.

See JavaDoc of HystrixRequestContext for more information about functionality this enables and how to use the default implementation.

Most used methods

  • get
    Retrieve current value or initialize and then return value for this variable for the current request

Popular in Java

  • Reading from database using SQL prepared statement
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • getResourceAsStream (ClassLoader)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Runner (org.openjdk.jmh.runner)
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now