flux.runtimeconfiguration
Interface ConcurrencyThrottle

All Superinterfaces:
java.lang.Cloneable

public interface ConcurrencyThrottle
extends java.lang.Cloneable

Contains a set of ConcurrencyConstraint objects, which control the number of jobs that are allowed to execute at the same time.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Method Summary
 void add(ConcurrencyConstraint concurrencyConstraint)
          Adds a new concurrency constraint to this concurrency throttle.
 ConcurrencyConstraint add(int limit)
          Adds a new concurrency constraint to this concurrency throttle.
 ConcurrencyConstraint add(java.lang.String concurrencyConstraint)
          Sets the concurrency throttle for this node.
 void clear()
          Deletes all concurrency constraints from this concurrency throttle.
 java.lang.Object clone()
          Returns a deep copy of this ConcurrencyThrottle object.
 boolean contains(ConcurrencyConstraint concurrencyConstraint)
          Indicates whether the specified concurrency constraint exists in this concurrency throttle.
 java.util.Iterator iterator()
          Returns all concurrency constraints in this concurrency throttle.
 boolean remove(ConcurrencyConstraint concurrencyConstraint)
          Deletes the specified concurrency constraint from this concurrency throttle.
 int size()
          Returns the number of concurrency constraints in this concurrency throttle.
 java.lang.String toString()
          Returns this concurrency throttle as a complete concurrency throttle expression, which can be used to create a new concurrency throttle.
 

Method Detail

add

void add(ConcurrencyConstraint concurrencyConstraint)
Adds a new concurrency constraint to this concurrency throttle.

Parameters:
concurrencyConstraint - The new concurrency constraint to this concurrency throttle.
Throws:
java.lang.IllegalArgumentException - If concurrencyConstraint is null.

add

ConcurrencyConstraint add(int limit)
Adds a new concurrency constraint to this concurrency throttle. The limit argument is used to create a concurrency constraint containing the specified limit.

For example, a limit of 15 indicates that no more than 15 jobs can run at a time from the current branch of the job tree.

Parameters:
limit - The new concurrency constraint to this concurrency throttle.
Throws:
java.lang.IllegalArgumentException - If limit is less than 0.

add

ConcurrencyConstraint add(java.lang.String concurrencyConstraint)
Sets the concurrency throttle for this node. The concurrencyConstraint argument is used to create a concurrency throttle containing the specified concurrency throttle expression.

For example, the concurrency throttle expression "/lightweight jobs/ <= 15" indicates that no more than 15 jobs can run at a time from the "/lightweight jobs/" branch of the job tree.

Parameters:
concurrencyConstraint - The concurrency throttle for this node.
Throws:
java.lang.IllegalArgumentException - If concurrencyConstraint is null, empty, or does not represent a valid concurrency throttle expression.

clear

void clear()
Deletes all concurrency constraints from this concurrency throttle.


clone

java.lang.Object clone()
Returns a deep copy of this ConcurrencyThrottle object.

Returns:
A deep copy of this ConcurrencyThrottle object.

contains

boolean contains(ConcurrencyConstraint concurrencyConstraint)
Indicates whether the specified concurrency constraint exists in this concurrency throttle.

Parameters:
concurrencyConstraint - The concurrency constraint that is used to check whether it exists in this concurrency throttle.
Returns:
Whether the specified concurrency constraint exists in this concurrency throttle. If concurrencyConstraint is null, returns null.

iterator

java.util.Iterator iterator()
Returns all concurrency constraints in this concurrency throttle.

Returns:
Iterator of ConcurrencyConstraint. All concurrency constraints in this concurrency throttle.

remove

boolean remove(ConcurrencyConstraint concurrencyConstraint)
Deletes the specified concurrency constraint from this concurrency throttle.

Parameters:
concurrencyConstraint - The concurrency constraint to delete.
Returns:
Whether the concurrency constraint was deleted. If concurrencyConstraint is null, returns false.

size

int size()
Returns the number of concurrency constraints in this concurrency throttle.

Returns:
The number of concurrency constraints in this concurrency throttle.

toString

java.lang.String toString()
Returns this concurrency throttle as a complete concurrency throttle expression, which can be used to create a new concurrency throttle. Each concurrency constraint within this concurrency throttle is displayed as a string, with an "&" symbol between each concurrency constraint.

For example, suppose this concurrency throttle contains the following three concurrency constraints.

/lightweights/ <= 15
/heavyweights/ <= 1
/misc/ <= 5

In the above example, the concurrency throttle is expressed as follows.

/lightweights/ <= 15 & /heavyweights/ <= 1 & /misc/ <= 5

Overrides:
toString in class java.lang.Object
Returns:
This concurrency throttle as a string.


© 2014 Flux Corporation. All rights reserved.