Class EvlContextParallel
java.lang.Object
org.eclipse.epsilon.eol.execute.context.EolContext
org.eclipse.epsilon.eol.execute.context.concurrent.EolContextParallel
org.eclipse.epsilon.erl.execute.context.concurrent.ErlContextParallel
org.eclipse.epsilon.evl.execute.context.concurrent.EvlContextParallel
- All Implemented Interfaces:
IEolContextParallel
,IEolContext
,IErlContextParallel
,IErlContext
,IEvlContextParallel
,IEvlContext
- Since:
- 1.6
- Author:
- Sina Madani
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConstraintTrace
protected boolean
protected boolean
protected boolean
protected Collection<UnsatisfiedConstraint>
Fields inherited from class org.eclipse.epsilon.eol.execute.context.concurrent.EolContextParallel
executorService
Fields inherited from class org.eclipse.epsilon.eol.execute.context.EolContext
assertionsEnabled, asyncStatementsQueue, classpathNativeTypeDelegate, errorStream, executorFactory, extendedProperties, frameStack, introspectionManager, methodContributorRegistry, modelRepository, module, nativeTypeDelegates, operationFactory, outputStream, prettyPrinterManager, profilingEnabled, userInput, warningStream
Fields inherited from interface org.eclipse.epsilon.eol.execute.context.concurrent.IEolContextParallel
NUM_THREADS_CONFIG
Fields inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
OPTIMIZE_CONSTRAINT_TRACE, SHORT_CIRCUIT
-
Constructor Summary
ConstructorsModifierConstructorDescriptionEvlContextParallel
(int parallelism) protected
EvlContextParallel
(IEolContext other) -
Method Summary
Modifier and TypeMethodDescriptionprotected IEvlContext
void
dispose()
Used internally to determine evaluated constraints.Casts the IModule to IErlModuleCan be used to obtain an optimal execution context while executing in parallel.This collection is written to internally by the engine during execution.boolean
Return true if the constraint results cache is optimized.boolean
Option allowing validation to terminate early when any invariant is unsatisfied.void
setOptimizeConstraintTrace
(boolean optimize) Set the flag for using optimized contraint result caching.void
setShortCircuit
(boolean shortCircuit) Sets whether short-circuited validation is enabled.boolean
shouldShortCircuit
(Constraint constraint) Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theIEvlContext.isShortCircuiting()
flag is enabled, or if the specified module element has been annotated with a termination criteria and an unsatisfied constraint containing the type is already present.This method is called internally once all constraints have been processed to convert the underlying collection inIEvlContext.getUnsatisfiedConstraints()
to a unique one.Methods inherited from class org.eclipse.epsilon.erl.execute.context.concurrent.ErlContextParallel
createThreadLocalExecutorFactory, executeJob, getExecutorFactory, setExecutorFactory, setProfilingEnabled
Methods inherited from class org.eclipse.epsilon.eol.execute.context.concurrent.EolContextParallel
beginParallelTask, clearExecutor, clearThreadLocals, convertToParallel, createThreadLocalFrameStack, createThreadLocalOperationContributorRegistry, endParallelTask, getExecutorService, getFrameStack, getParallelism, initDelegateThreadLocal, initThreadLocals, isParallel, newExecutorService, nullifyThreadLocals, parallelGet, parallelGet, parallelSet, removeAll, setFrameStack, setParallelism, toString, useThreadLocalValue
Methods inherited from class org.eclipse.epsilon.eol.execute.context.EolContext
getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExtendedProperties, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setUserInput, setWarningStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.epsilon.eol.execute.context.IEolContext
getAsyncStatementsQueue, getErrorStream, getExtendedProperties, getFrameStack, getIntrospectionManager, getModelRepository, getNativeTypeDelegates, getOperationContributorRegistry, getOperationFactory, getOutputStream, getPrettyPrinterManager, getUserInput, getWarningStream, isAssertionsEnabled, isProfilingEnabled, setAssertionsEnabled, setErrorStream, setExecutorFactory, setExtendedProperties, setFrameStack, setIntrospectionManager, setModelRepository, setModule, setNativeTypeDelegates, setOperationFactory, setOutputStream, setPrettyPrinterManager, setProfilingEnabled, setUserInput, setWarningStream
Methods inherited from interface org.eclipse.epsilon.eol.execute.context.concurrent.IEolContextParallel
beginParallelTask, beginParallelTask, endParallelTask, ensureNotNested, executeAll, executeAny, getExecutorService, getParallelism, isParallel, isParallelisationLegal, setParallelism
Methods inherited from interface org.eclipse.epsilon.erl.execute.context.IErlContext
getExecutorFactory
Methods inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
getConstraintsDependedOn, getUnsatisfiedConstraintsBySize, hasFixes, sortUnsatisfiedConstraints
-
Field Details
-
unsatisfiedConstraints
-
constraintTrace
-
optimizeConstraintTrace
protected boolean optimizeConstraintTrace -
shortCircuiting
protected boolean shortCircuiting -
terminate
protected boolean terminate
-
-
Constructor Details
-
EvlContextParallel
public EvlContextParallel() -
EvlContextParallel
public EvlContextParallel(int parallelism) - Parameters:
parallelism
- The number of threads to use.threadSafeBaseFrames
- whether the base FrameStack should use a thread-safe collection. default istrue
-
EvlContextParallel
-
-
Method Details
-
createShadowThreadLocalContext
- Overrides:
createShadowThreadLocalContext
in classErlContextParallel
-
getShadow
Description copied from class:EolContextParallel
Can be used to obtain an optimal execution context while executing in parallel. If execution is currently not parallel, then this context itself is returned.- Overrides:
getShadow
in classErlContextParallel
- Returns:
- A ThreadLocal copy of this context if in parallel, or this context otherwise.
-
uniqueUnsatisfiedConstraints
Description copied from interface:IEvlContext
This method is called internally once all constraints have been processed to convert the underlying collection inIEvlContext.getUnsatisfiedConstraints()
to a unique one.- Specified by:
uniqueUnsatisfiedConstraints
in interfaceIEvlContext
- Returns:
- The final, filtered set of UnsatisfiedConstraints suitable for post-processing.
-
getUnsatisfiedConstraints
Description copied from interface:IEvlContext
This collection is written to internally by the engine during execution. AlthoughIEvlModule.execute()
mandates the results to be a Set, for performance optimisation reasons this method is permitted to return any collection, so long as once execution is complete, the results contain no duplicates. This collection should therefore only be used to add elements, and is expected not to be queried during execution.- Specified by:
getUnsatisfiedConstraints
in interfaceIEvlContext
- Returns:
- A mutable collection of unsatisfied Constraint-element pairs.
-
getConstraintTrace
Description copied from interface:IEvlContext
Used internally to determine evaluated constraints.- Specified by:
getConstraintTrace
in interfaceIEvlContext
- Returns:
- The checked Constraint-element pairs, or
null
if the trace is disabled.
-
setOptimizeConstraintTrace
public void setOptimizeConstraintTrace(boolean optimize) Description copied from interface:IEvlContext
Set the flag for using optimized contraint result caching.- Specified by:
setOptimizeConstraintTrace
in interfaceIEvlContext
- See Also:
-
isOptimizeConstraintTrace
public boolean isOptimizeConstraintTrace()Description copied from interface:IEvlContext
Return true if the constraint results cache is optimized. When optimized, constraint results will only be cached during satisfies operation executions, that is, results will only be cached if required. If false, constraint results will always be cached.The default value is false;
- Specified by:
isOptimizeConstraintTrace
in interfaceIEvlContext
- Returns:
- The value of the flag.
-
isShortCircuiting
public boolean isShortCircuiting()Description copied from interface:IEvlContext
Option allowing validation to terminate early when any invariant is unsatisfied.- Specified by:
isShortCircuiting
in interfaceIEvlContext
- Specified by:
isShortCircuiting
in interfaceIEvlContextParallel
- Returns:
- Whether validation will stop once an UnsatisfiedConstraint is found.
-
setShortCircuit
public void setShortCircuit(boolean shortCircuit) Description copied from interface:IEvlContext
Sets whether short-circuited validation is enabled.- Specified by:
setShortCircuit
in interfaceIEvlContext
- Specified by:
setShortCircuit
in interfaceIEvlContextParallel
- Parameters:
shortCircuit
- The new value for the flag.
-
shouldShortCircuit
Description copied from interface:IEvlContext
Checks whether the condition for short-circuiting is met, either by previous invocation returning true or if there are unsatisfied constraints and theIEvlContext.isShortCircuiting()
flag is enabled, or if the specified module element has been annotated with a termination criteria and an unsatisfied constraint containing the type is already present.- Specified by:
shouldShortCircuit
in interfaceIEvlContext
- Returns:
- Whether termination should be suspended.
- Throws:
EolRuntimeException
-
getModule
Description copied from interface:IErlContext
Casts the IModule to IErlModule- Specified by:
getModule
in interfaceIEolContext
- Specified by:
getModule
in interfaceIErlContext
- Specified by:
getModule
in interfaceIEvlContext
- Overrides:
getModule
in classErlContextParallel
- See Also:
-
dispose
public void dispose()- Specified by:
dispose
in interfaceIEolContext
- Overrides:
dispose
in classEolContextParallel
-