Tabnine Logo
Engine.runWithPermit
Code IndexAdd Tabnine to your IDE (free)

How to use
runWithPermit
method
in
com.linkedin.parseq.Engine

Best Java code snippets using com.linkedin.parseq.Engine.runWithPermit (Showing top 6 results out of 315)

origin: linkedin/parseq

/**
 * Runs the given task if Engine has a capacity to start new plan as specified by
 * {@value #MAX_CONCURRENT_PLANS} configuration parameter.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 * Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * This method returns immediately and does not block. It returns {@code true} if Plan was successfully started.
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan
 * @return true if Plan was started
 */
public boolean tryRun(final Task<?> task, final String planClass) {
 if (tryAcquirePermit(planClass)) {
  runWithPermit(task, planClass);
  return true;
 } else {
  return false;
 }
}
origin: linkedin/parseq

/**
 * Runs the given task. Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * <p>
 * This method blocks until Engine has a capacity to run the task. Engine's capacity is
 * specified by a {@value #MAX_CONCURRENT_PLANS} configuration property. Use
 * {@link EngineBuilder#setEngineProperty(String, Object)} to set this property.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 *
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan. Plan class ends up in a ParSeq
 * Trace and can be used to group traces into "classes" when traces are statistically analyzed.
 */
public void blockingRun(final Task<?> task, final String planClass) {
 try {
  acquirePermit(planClass);
  runWithPermit(task, planClass);
 } catch (InterruptedException e) {
  Thread.currentThread().interrupt();
 }
}
origin: linkedin/parseq

/**
 * Runs the given task if Engine has a capacity to start new plan as specified by
 * {@value #MAX_CONCURRENT_PLANS} configuration parameter within specified amount of time.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 * Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * If Engine does not have capacity to start the task, this method will block up to specified amount of
 * time waiting for other concurrently running Plans to complete. If there is no capacity to start the task
 * within specified amount of time this method will return false. It returns {@code true} if Plan was successfully started.
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan
 * @param timeout amount of time to wait for Engine's capacity to run the task
 * @param unit
 * @return true if Plan was started within the given waiting time and the current thread has not
 * been {@linkplain Thread#interrupt interrupted}.
*/
public boolean tryRun(final Task<?> task, final String planClass, final long timeout, final TimeUnit unit) throws InterruptedException {
 if (tryAcquirePermit(planClass, timeout, unit)) {
  runWithPermit(task, planClass);
  return true;
 } else {
  return false;
 }
}
origin: com.linkedin.parseq/parseq

/**
 * Runs the given task if Engine has a capacity to start new plan as specified by
 * {@value #MAX_CONCURRENT_PLANS} configuration parameter.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 * Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * This method returns immediately and does not block. It returns {@code true} if Plan was successfully started.
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan
 * @return true if Plan was started
 */
public boolean tryRun(final Task<?> task, final String planClass) {
 if (tryAcquirePermit(planClass)) {
  runWithPermit(task, planClass);
  return true;
 } else {
  return false;
 }
}
origin: com.linkedin.parseq/parseq

/**
 * Runs the given task. Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * <p>
 * This method blocks until Engine has a capacity to run the task. Engine's capacity is
 * specified by a {@value #MAX_CONCURRENT_PLANS} configuration property. Use
 * {@link EngineBuilder#setEngineProperty(String, Object)} to set this property.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 *
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan. Plan class ends up in a ParSeq
 * Trace and can be used to group traces into "classes" when traces are statistically analyzed.
 */
public void blockingRun(final Task<?> task, final String planClass) {
 try {
  acquirePermit(planClass);
  runWithPermit(task, planClass);
 } catch (InterruptedException e) {
  Thread.currentThread().interrupt();
 }
}
origin: com.linkedin.parseq/parseq

/**
 * Runs the given task if Engine has a capacity to start new plan as specified by
 * {@value #MAX_CONCURRENT_PLANS} configuration parameter within specified amount of time.
 * For the sake of backwards compatibility default value for a {@value #MAX_CONCURRENT_PLANS} is
 * {@value #DEFUALT_MAX_CONCURRENT_PLANS} which essentially means "unbounded capacity".
 * Task passed in as a parameter becomes a root on a new Plan.
 * All tasks created and started as a consequence of a root task will belong to that plan and will share a Trace.
 * If Engine does not have capacity to start the task, this method will block up to specified amount of
 * time waiting for other concurrently running Plans to complete. If there is no capacity to start the task
 * within specified amount of time this method will return false. It returns {@code true} if Plan was successfully started.
 * @param task the task to run
 * @param planClass string that identifies a "class" of the Plan
 * @param timeout amount of time to wait for Engine's capacity to run the task
 * @param unit
 * @return true if Plan was started within the given waiting time and the current thread has not
 * been {@linkplain Thread#interrupt interrupted}.
*/
public boolean tryRun(final Task<?> task, final String planClass, final long timeout, final TimeUnit unit) throws InterruptedException {
 if (tryAcquirePermit(planClass, timeout, unit)) {
  runWithPermit(task, planClass);
  return true;
 } else {
  return false;
 }
}
com.linkedin.parseqEnginerunWithPermit

Javadoc

Runs the given task with its own context. Use Tasks.seq and Tasks.par to create and run composite tasks.

Popular methods of Engine

  • run
    Runs the given task. Task passed in as a parameter becomes a root on a new Plan. All tasks created a
  • shutdown
    If the engine is currently running, this method will initiate an orderly shutdown. No new tasks will
  • blockingRun
    Runs the given task. Task passed in as a parameter becomes a root on a new Plan. All tasks created a
  • tryRun
    Runs the given task if Engine has a capacity to start new plan as specified by #MAX_CONCURRENT_PLANS
  • <init>
  • acquirePermit
  • createTaskQueueFactory
  • defaultPlanClass
  • getProperty
  • tryAcquirePermit
  • tryTransitionShutdown
  • tryTransitionTerminate
  • tryTransitionShutdown,
  • tryTransitionTerminate,
  • awaitTermination,
  • isShutdown,
  • isTerminated

Popular in Java

  • Reactive rest calls using spring rest template
  • setContentView (Activity)
  • compareTo (BigDecimal)
  • setScale (BigDecimal)
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Top plugins for WebStorm
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