final class PKEParallelTasksPropertyStore extends PropertyStore
A concurrent implementation of the property store which parallels the execution of the scheduled computations.
Entities are stored after computation.
Implementation
The idea is to use one specific thread (the store updates thread) for processing updates
to the store. This enables us to avoid any synchronization w.r.t. updating the
depender/dependee relations.
We use NumberOfThreadsForProcessingPropertyComputations threads for processing the
scheduled computations.
- Self Type
- PKEParallelTasksPropertyStore
- Alphabetic
- By Inheritance
- PKEParallelTasksPropertyStore
- PropertyStore
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val NumberOfThreadsForProcessingPropertyComputations: Int
-
final
def
apply[E <: Entity, P <: Property](epk: EPK[E, P]): EOptionP[E, P]
Returns the property of the respective property kind
pkcurrently associated with the given elemente.Returns the property of the respective property kind
pkcurrently associated with the given elemente.This is the most basic method to get some property and it is the preferred way if (a) you know that the property is already available – e.g., because some property computation function was strictly run before the current one – or if (b) the property is computed using a lazy property computation - or if (c) it may be possible to compute a final answer even if the property of the entity is not yet available.
- epk
An entity/property key pair.
- returns
EPK(e,pk)if information about the respective property is not (yet) available.Final|IntermediateEP(e,Property)otherwise.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Exceptions thrown
IllegalStateExceptionIf setup phase was not called or a previous computation result contained an epk which was not queried. (Both state are ALWAYS illegal, but are only explicitly checked for if debug is turned on!)- Note
In general, the returned value may change over time but only such that it is strictly more precise.
,Querying a property may trigger the (lazy) computation of the property.
,setupPhase has to be called before calling apply!
-
def
apply[E <: Entity, P <: Property](e: E, pk: PropertyKey[P]): EOptionP[E, P]
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- See also
apply(epk:EPK)for details.
-
final
def
apply[E <: Entity, P <: Property](es: Traversable[E], pmi: PropertyMetaInformation { type Self <: P }): Traversable[EOptionP[E, P]]
Returns a snapshot of the properties with the given kind associated with the given entities.
Returns a snapshot of the properties with the given kind associated with the given entities.
- Definition Classes
- PropertyStore
- Note
Querying the properties of the given entities will trigger lazy computations.
,The returned collection can be used to create an IntermediateResult.
- See also
apply(epk:EPK)for details.
-
final
def
apply[E <: Entity, P <: Property](es: Traversable[E], pk: PropertyKey[P]): Traversable[EOptionP[E, P]]
Returns a snapshot of the properties with the given kind associated with the given entities.
Returns a snapshot of the properties with the given kind associated with the given entities.
- Definition Classes
- PropertyStore
- Note
Querying the properties of the given entities will trigger lazy computations.
,The returned collection can be used to create an IntermediateResult.
- See also
apply(epk:EPK)for details.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
collectAndThrowException(t: Throwable): Nothing
- Attributes
- protected[this]
- Definition Classes
- PropertyStore
- Annotations
- @inline()
-
def
collectException(t: Throwable): Unit
- Attributes
- protected[this]
- Definition Classes
- PropertyStore
-
final
def
context[T](key: Class[T]): T
Looks up the context object of the given type.
Looks up the context object of the given type. This is a comparatively expensive operation; the result should be cached.
- Definition Classes
- PropertyStore
-
val
ctx: Map[Class[_], AnyRef]
Immutable map which stores the context objects given at initialization time.
Immutable map which stores the context objects given at initialization time.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
debug: Boolean
If "debug" is
trueand we have an update related to an ordered property, we will then check if the update is correct!If "debug" is
trueand we have an update related to an ordered property, we will then check if the update is correct!- Definition Classes
- PropertyStore
- def directDependeeUpdatesCount: Int
-
def
directDependerOnUpdateComputationsCount: Int
Computations which are executed immediately and which are not scheduled.
- def directInTaskThreadPropertyComputationsCount: Int
-
def
entities[P <: Property](pk: PropertyKey[P]): Iterator[EPS[Entity, P]]
Returns all entities which have a property of the respective kind.
Returns all entities which have a property of the respective kind. This method returns a consistent snapshot view of the store w.r.t. the given PropertyKey.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
Does not trigger lazy property computations.
-
def
entities[P <: Property](lb: P, ub: P): Iterator[Entity]
Returns all entities which have the given (regular / not simple) property bounds based on an "==" (equals) comparison.
Returns all entities which have the given (regular / not simple) property bounds based on an "==" (equals) comparison.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
entities(propertyFilter: (SomeEPS) ⇒ Boolean): Iterator[Entity]
The set of all entities which already have an entity property state that passes the given filter.
The set of all entities which already have an entity property state that passes the given filter.
This method returns a snapshot.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
Does not trigger lazy property computations.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
var
exception: Throwable
- Attributes
- protected[this]
- Definition Classes
- PropertyStore
- def fallbacksUsedCount: Int
-
def
fastTrackPropertiesCount: Int
The number of properties that were computed using a fast-track.
The number of properties that were computed using a fast-track.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
finalEntities[P <: Property](p: P): Iterator[Entity]
Returns all final entities with the given property.
Returns all final entities with the given property.
- Definition Classes
- PropertyStore
- Note
Does not trigger lazy property computations.
-
def
finalize(): Unit
- Definition Classes
- PKEParallelTasksPropertyStore → AnyRef
-
def
force[E <: Entity, P <: Property](e: E, pk: PropertyKey[P]): Unit
Enforce the evaluation of the specified property kind for the given entity, even if the property is computed lazily and no "eager computation" requires the results anymore.
Enforce the evaluation of the specified property kind for the given entity, even if the property is computed lazily and no "eager computation" requires the results anymore. Force also ensures that the property is stored in the store even if the fallback value is used. Using
forceis in particular necessary in cases where a specific analysis should be scheduled lazily because the computed information is not necessary for all entities, but strictly required for some elements. E.g., if you want to compute a property for some piece of code, but not for those elements of the used library that are strictly necessary. For example, if we want to compute the purity of the methods of a specific application, we may have to compute the property for some entities of the libraries, but we don't want to compute them for all.- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
Triggers lazy evaluations.
-
def
gatherExceptions(f: ⇒ Unit): Unit
- Attributes
- protected[this]
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
handleExceptions[U](f: ⇒ U): U
- Attributes
- protected[this]
- Definition Classes
- PropertyStore
- Annotations
- @inline()
-
final
def
handleResult(r: PropertyComputationResult, forceEvaluation: Boolean): Unit
Processes the result eventually; generally, not directly called by analyses.
Processes the result eventually; generally, not directly called by analyses. If this function is directly called, the caller has to ensure that we don't have overlapping results and that the given result is a meaningful update of the previous property associated with the respective entity - if any!
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Exceptions thrown
IllegalStateExceptionIf the result cannot be applied.- Note
If any computation resulted in an exception, then
handleResultwill fail and the exception related to the failing computation will be thrown again.
-
def
hasProperty(e: Entity, pk: PropertyKind): Boolean
See
hasProperty(SomeEPK)for details.See
hasProperty(SomeEPK)for details. *- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
hasProperty(epk: SomeEPK): Boolean
Tests if we have a property for the entity with the respective kind.
Tests if we have a property for the entity with the respective kind. If
hasPropertyreturnstruea subsequentapplywill return anEPS(not anEPK).- Definition Classes
- PropertyStore
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
immediateOnUpdateComputationsCount: Int
The number of times a property was directly computed again due to an updated dependee.
The number of times a property was directly computed again due to an updated dependee.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isKnown(e: Entity): Boolean
Returns
trueif the given entity is known to the property store.Returns
trueif the given entity is known to the property store. Here,isKnowncan mean- that we actually have a property, or
- a computation is scheduled/running to compute some property, or
- an analysis has a dependency on some (not yet finally computed) property, or
- that the store just eagerly created the data structures necessary to associate properties with the entity.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
var
isSuspended: () ⇒ Boolean
The callback function that is regularly called by the property store to test if the property store should stop executing new tasks.
The callback function that is regularly called by the property store to test if the property store should stop executing new tasks. Given that the given method is called frequently, it should be reasonably efficient. The method has to be thread-safe.
The default method tests if the current thread is interrupted.
Suspending the property store will leave the property store in a consistent state and the computation can be continued later on by updating this function (if necessary) and calling
waitOnPhaseCompletionagain. I.e., interruption can be used for debugging purposes!- Definition Classes
- PropertyStore
-
implicit
val
logContext: LogContext
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
onFirstException(t: Throwable): Unit
Called when the first top-level exception occurs.
Called when the first top-level exception occurs. Intended to be overridden by subclasses.
- Attributes
- protected[this]
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
properties[E <: Entity](e: E): Iterator[EPS[E, Property]]
Returns an iterator of the different properties associated with the given element.
Returns an iterator of the different properties associated with the given element.
This method is the preferred way to get a snapshot of all properties of an entity and should be used if you know that all properties are already computed. Using this method will not trigger the computation of a property.
- e
An entity stored in the property store.
- returns
Iterator[Property]
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
The returned traversable operates on a snapshot.
,Does not trigger lazy property computations.
-
def
quiescenceCount: Int
The number of times the property store reached quiescence.
The number of times the property store reached quiescence.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- def redundantIdempotentResultsCount: Int
-
def
registerLazyMultiPropertyComputation[E <: Entity, P <: Property](pc: PropertyComputation[E], pks: PropertyKey[P]*): Unit
Registers a function that lazily computes multiple properties of different kinds at the same time for an element of the store.
Registers a function that lazily computes multiple properties of different kinds at the same time for an element of the store.
For further details see registerLazyPropertyComputation.
- Definition Classes
- PropertyStore
-
def
registerLazyPropertyComputation[E <: Entity, P <: Property](pk: PropertyKey[P], pc: PropertyComputation[E]): Unit
Registers a function that lazily computes a property for an element of the store if the property of the respective kind is requested.
Registers a function that lazily computes a property for an element of the store if the property of the respective kind is requested. Hence, a first request of such a property will always first return no result.
The computation is triggered by a(n in)direct call of this store's
applymethod.This store ensures that the property computation function
pcis never invoked more than once for the same element at the same time. Ifpcis invoked again for a specific element then only because a dependee has changed!In general, the result can't be an
IncrementalResultandscheduleLazyPropertyComputationcannot be used for properties which should be computed by phased analyses.A lazy computation must never return a NoResult; if the entity cannot be processed an exception has to be thrown or the bottom value has to be returned.
Setting
scheduleLazyPropertyComputationis only supported as long as the store is not queried. In general, this requires that lazy property computations are scheduled before any eager analysis that potentially reads the value.- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
registerTriggeredComputation[E <: Entity, P <: Property](pk: PropertyKey[P], pc: PropertyComputation[E]): Unit
Registers a property computation that is eagerly triggered when a property of the given kind is derived for some entity for the first time.
Registers a property computation that is eagerly triggered when a property of the given kind is derived for some entity for the first time. Note, that the property computation function – as usual – has to be thread safe (only on-update continuation functions are guaranteed to be executed sequentially per E/PK pair). The primary use case is to kick-start the computation of some e/pk as soon as an entity "becomes relevant".
In general, it also possible to have a standard analysis that just queries the properties of the respective entities and which maintains the list of dependees. However, if the list of dependees becomes larger and (at least initially) encompasses a significant fraction or even all entities of a specific kind, the overhead that is generated in the framework becomes very huge. In this case, it is way more efficient to register a triggered computation.
For example, if you want to do some processing (kick-start further computations) related to methods that are reached, it is more efficient to register a property computation that is triggered when a method's
Callerproperty is set. Please note, that the property computation is allowed to query and depend on the property that initially kicked-off the computation in the first place. Querying the property store may in particular be required to identify the reason why the property was set. For example, if theCallerproperty was set to the fallback due to a depending computation, it may be necessary to distinguish between the case "no callers" and "unknown callers"; in case of the final property "no callers" the result may very well be NoResult.- pk
The property key.
- pc
The computation that is (potentially concurrently) called to kick-start a computation related to the given entity.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
resolvedCSCCsCount: Int
The number of resolved closed strongly connected components.
The number of resolved closed strongly connected components.
Please note, that depending on the implementation strategy and the type of the closed strongly connected component, the resolution of one strongly connected component may require multiple phases. This is in particular true if a cSCC is resolved by committing an arbitrary value as a final value and we have a cSCC which is actually a chain-like cSCC. In the latter case committing a single value as final which just break up the chain, but will otherwise (in case of chains with more than three elements) lead to new cSCCs which the require detection and resolution.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
scheduleEagerComputationForEntity[E <: Entity](e: E)(pc: PropertyComputation[E]): Unit
Schedules the execution of the given
PropertyComputationfunction for the given entity.Schedules the execution of the given
PropertyComputationfunction for the given entity. This is of particular interest to start an incremental computation (cf. IncrementalResult) which, e.g., processes the class hierarchy in a top-down manner.- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
It is NOT possible to use scheduleEagerComputationForEntity for properties which are also computed by a lazy property computation; use
,forceinstead!If any computation resulted in an exception, then the scheduling will fail and the exception related to the failing computation will be thrown again.
-
def
scheduleEagerComputationsForEntities[E <: Entity](es: TraversableOnce[E])(c: PropertyComputation[E]): Unit
Will call the given function
cfor all elements ofesin parallel.Will call the given function
cfor all elements ofesin parallel.- Definition Classes
- PropertyStore
- See also
scheduleEagerComputationForEntity for details.
-
def
scheduledDependeeUpdatesCount: Int
Computations of dependees which are scheduled immediately.
- def scheduledLazyTasksCount: Int
-
def
scheduledOnUpdateComputationsCount: Int
Simple counter of the number of tasks (OnUpdateContinuations) that were executed in response to an updated property.
Simple counter of the number of tasks (OnUpdateContinuations) that were executed in response to an updated property.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
scheduledTasksCount: Int
Simple counter of the number of tasks that were executed to perform an initial computation of a property for some entity.
Simple counter of the number of tasks that were executed to perform an initial computation of a property for some entity.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
set(e: Entity, p: Property): Unit
Directly associates the given property
pwith property kindpkwith the given entityeifehas no property of the respective kind.Directly associates the given property
pwith property kindpkwith the given entityeifehas no property of the respective kind. The set property is always final. The store does not guarantee that the value is set before before a later scheduled analysis is executed. I.e., no guarantee is given that the value is set immediately.A use case is an analysis that does use the property store while executing the analysis, but which wants to store the results in the store. Such an analysis must be executed before any other analysis is scheduled.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Exceptions thrown
IllegalStateExceptionIf a different property is already associated with the given entity or a lazy computation is registered. I.e.,sethas to be called before respective lazy property computations are registered. The exception may be thrown eventually!- Note
This method must not be used if there might be another computation that computes the property kind
pkforeand which returns the respective property as a result.
-
def
setupPhase(computedPropertyKinds: Set[PropertyKind], delayedPropertyKinds: Set[PropertyKind]): Unit
Needs to be called before an analysis is scheduled to inform the property store which properties will be computed now and which are computed in a later phase.
Needs to be called before an analysis is scheduled to inform the property store which properties will be computed now and which are computed in a later phase. The later information is used to decide when we use a fallback.
- computedPropertyKinds
The kinds of properties for which we will schedule computations.
- delayedPropertyKinds
The set of property kinds which will (also) be computed in a later phase; no fallback will be used for dependencies to properties of the respective kind.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
setupPhaseeven needs to be called if just fallback values should be computed; in this case both sets have to be empty.
-
def
shutdown(): Unit
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
def
statistics: Map[String, Int]
Core statistics.
Core statistics.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
supportsFastTrackPropertyComputations: Boolean
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(printProperties: Boolean): String
Returns a consistent snapshot of the stored properties.
Returns a consistent snapshot of the stored properties.
- printProperties
If
trueprints the properties of all entities.
- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
Some computations may still be running.
-
def
toString(): String
Returns a short string representation of the property store showing core figures.
Returns a short string representation of the property store showing core figures.
- Definition Classes
- PropertyStore → AnyRef → Any
-
final
def
traceCycleResolutions: Boolean
- Definition Classes
- PropertyStore
-
final
def
traceFallbacks: Boolean
- Definition Classes
- PropertyStore
- val tracer: Option[PropertyStoreTracer]
-
var
useFastTrackPropertyComputations: Boolean
- Definition Classes
- PropertyStore
- def uselessPartialResultComputationCount: Int
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
waitOnPhaseCompletion(): Unit
Awaits the completion of all property computations which were previously scheduled.
Awaits the completion of all property computations which were previously scheduled. As soon as all initial computations have finished, dependencies on E/P pairs for which no value was computed and also will not be computed in the future(!) (see
setupPhasefor details), will be identified and the fallback value will be used. After that, cycle resolution will be performed. I.e., first all _closed_ strongly connected components will be identified that do not contain any properties for which we will compute (in a future phase) any more refined values. Then the values will be made final.If the store is suspended, waitOnPhaseCompletion will return as soon as all running computations are finished. By updating the
isSuspendedstate and callingwaitOnPhaseCompletionagain computations can be continued.- Definition Classes
- PKEParallelTasksPropertyStore → PropertyStore
- Note
If a second thread is used to register org.opalj.fpcf.PropertyComputation functions no guarantees are given; it is recommended to schedule all property computation functions using one thread and to also use that thread to call this method.
,If a computation fails with an exception, the property store will stop in due time and return the thrown exception. No strong guarantees are given which exception is returned in case of concurrent execution with multiple exceptions.
,In case of an exception, the analyses are aborted as fast as possible and the store is no longer usable.