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 ConstraintTraceprotected booleanprotected booleanprotected booleanprotected Collection<UnsatisfiedConstraint>Fields inherited from class org.eclipse.epsilon.eol.execute.context.concurrent.EolContextParallel
executorServiceFields 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, warningStreamFields inherited from interface org.eclipse.epsilon.eol.execute.context.concurrent.IEolContextParallel
NUM_THREADS_CONFIGFields inherited from interface org.eclipse.epsilon.evl.execute.context.IEvlContext
OPTIMIZE_CONSTRAINT_TRACE, SHORT_CIRCUIT -
Constructor Summary
ConstructorsModifierConstructorDescriptionEvlContextParallel(int parallelism) protectedEvlContextParallel(IEolContext other) -
Method Summary
Modifier and TypeMethodDescriptionprotected IEvlContextvoiddispose()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.booleanReturn true if the constraint results cache is optimized.booleanOption allowing validation to terminate early when any invariant is unsatisfied.voidsetOptimizeConstraintTrace(boolean optimize) Set the flag for using optimized contraint result caching.voidsetShortCircuit(boolean shortCircuit) Sets whether short-circuited validation is enabled.booleanshouldShortCircuit(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, setProfilingEnabledMethods 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, useThreadLocalValueMethods 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, setWarningStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, setWarningStreamMethods inherited from interface org.eclipse.epsilon.eol.execute.context.concurrent.IEolContextParallel
beginParallelTask, beginParallelTask, endParallelTask, ensureNotNested, executeAll, executeAny, getExecutorService, getParallelism, isParallel, isParallelisationLegal, setParallelismMethods inherited from interface org.eclipse.epsilon.erl.execute.context.IErlContext
getExecutorFactoryMethods 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:
createShadowThreadLocalContextin classErlContextParallel
-
getShadow
Description copied from class:EolContextParallelCan 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:
getShadowin classErlContextParallel- Returns:
- A ThreadLocal copy of this context if in parallel, or this context otherwise.
-
uniqueUnsatisfiedConstraints
Description copied from interface:IEvlContextThis method is called internally once all constraints have been processed to convert the underlying collection inIEvlContext.getUnsatisfiedConstraints()to a unique one.- Specified by:
uniqueUnsatisfiedConstraintsin interfaceIEvlContext- Returns:
- The final, filtered set of UnsatisfiedConstraints suitable for post-processing.
-
getUnsatisfiedConstraints
Description copied from interface:IEvlContextThis 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:
getUnsatisfiedConstraintsin interfaceIEvlContext- Returns:
- A mutable collection of unsatisfied Constraint-element pairs.
-
getConstraintTrace
Description copied from interface:IEvlContextUsed internally to determine evaluated constraints.- Specified by:
getConstraintTracein interfaceIEvlContext- Returns:
- The checked Constraint-element pairs, or
nullif the trace is disabled.
-
setOptimizeConstraintTrace
public void setOptimizeConstraintTrace(boolean optimize) Description copied from interface:IEvlContextSet the flag for using optimized contraint result caching.- Specified by:
setOptimizeConstraintTracein interfaceIEvlContext- See Also:
-
isOptimizeConstraintTrace
public boolean isOptimizeConstraintTrace()Description copied from interface:IEvlContextReturn 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:
isOptimizeConstraintTracein interfaceIEvlContext- Returns:
- The value of the flag.
-
isShortCircuiting
public boolean isShortCircuiting()Description copied from interface:IEvlContextOption allowing validation to terminate early when any invariant is unsatisfied.- Specified by:
isShortCircuitingin interfaceIEvlContext- Specified by:
isShortCircuitingin interfaceIEvlContextParallel- Returns:
- Whether validation will stop once an UnsatisfiedConstraint is found.
-
setShortCircuit
public void setShortCircuit(boolean shortCircuit) Description copied from interface:IEvlContextSets whether short-circuited validation is enabled.- Specified by:
setShortCircuitin interfaceIEvlContext- Specified by:
setShortCircuitin interfaceIEvlContextParallel- Parameters:
shortCircuit- The new value for the flag.
-
shouldShortCircuit
Description copied from interface:IEvlContextChecks 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:
shouldShortCircuitin interfaceIEvlContext- Returns:
- Whether termination should be suspended.
- Throws:
EolRuntimeException
-
getModule
Description copied from interface:IErlContextCasts the IModule to IErlModule- Specified by:
getModulein interfaceIEolContext- Specified by:
getModulein interfaceIErlContext- Specified by:
getModulein interfaceIEvlContext- Overrides:
getModulein classErlContextParallel- See Also:
-
dispose
public void dispose()- Specified by:
disposein interfaceIEolContext- Overrides:
disposein classEolContextParallel
-