public final class SolverCache extends Object
Solver
that manages computing it when necessary from
FeatureVectors
, tracking when it must be recomputed, and doing so
correctly in the presence of multiple threads.Constructor and Description |
---|
SolverCache(Executor executor,
FeatureVectors vectorPartitions) |
Modifier and Type | Method and Description |
---|---|
void |
compute()
Proactively try to compute the solver asynchronously, if not already computed.
|
Solver |
get(boolean blocking) |
void |
setDirty()
Indicates that the underlying
FeatureVectors have changed and so the
resulting Solver should be recomputed. |
public SolverCache(Executor executor, FeatureVectors vectorPartitions)
executor
- Executor
which should be used to asynchronously compute
a Solver
. Important: this should be able to execute more than 1 task in parallel.vectorPartitions
- underling FeatureVectors
data from which it should be
computedpublic void setDirty()
FeatureVectors
have changed and so the
resulting Solver
should be recomputed.public void compute()
public Solver get(boolean blocking)
blocking
- whether to block waiting for a first modelSolver
, optionally blocking if necessary to wait for an initial one to
be computed. It does not block otherwise and returns the most recently computed one.
Note that this method may return null
even when blocking , for instance,
if no solver is computable because there is no data.Copyright © 2014–2018. All rights reserved.