|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.service.FederationCallable<T>
com.bigdata.service.DataServiceCallable<RuleStats>
com.bigdata.relation.rule.eval.AbstractStepTask
public abstract class AbstractStepTask
| Field Summary | |
|---|---|
protected ActionEnum |
action
|
protected IIndexManager |
indexManager
|
protected IJoinNexusFactory |
joinNexusFactory
|
protected static org.apache.log4j.Logger |
log
|
protected IStep |
step
|
| Constructor Summary | |
|---|---|
protected |
AbstractStepTask(ActionEnum action,
IJoinNexusFactory joinNexusFactory,
IStep step,
IIndexManager indexManager,
DataService dataService)
Base class handles submit either to the caller's ExecutorService
or to the ConcurrencyManager IFF the task was submitted to a
DataService. |
| Method Summary | |
|---|---|
AbstractStepTask |
clone()
Strengthens the return type and masquerades the CloneNotSupportedException. |
protected Set<String> |
getIndexNames(Collection<IRelation> c)
Returns the names of the indices maintained by the relations. |
protected Map<String,IBuffer<ISolution[]>> |
getMutationBuffers(IJoinNexus joinNexus,
Map<String,IRelation> relations)
Create the appropriate buffers to absorb writes by the rules in the program that target an IMutableRelation. |
protected Map<String,IRelation> |
getReadRelations(IIndexManager indexManager,
IStep step,
long timestamp)
Locate the distinct relation identifiers corresponding to the tail(s) of each rule and resolve them to their relations. |
protected Set<String> |
getWriteRelationNames(IStep step)
The set of distinct relations identified by the head of each rule in the program. |
protected Map<String,IRelation> |
getWriteRelations(IIndexManager indexManager,
IStep step,
long timestamp)
Locate the distinct relation identifiers corresponding to the head of each rule and resolve them to their relations. |
protected RuleStats |
runOne(IJoinNexus joinNexus,
IStep program,
Callable<RuleStats> task)
Run a single step (sequence of one). |
protected RuleStats |
runParallel(IJoinNexus joinNexus,
IStep program,
List<Callable<RuleStats>> tasks)
Run program steps in parallel. |
protected RuleStats |
runSequential(IJoinNexus joinNexus,
IStep program,
List<Callable<RuleStats>> tasks)
Run program steps in sequence. |
Future<RuleStats> |
submit()
Run this task. |
String |
toString()
|
| Methods inherited from class com.bigdata.service.DataServiceCallable |
|---|
getDataService, isDataService, setDataService |
| Methods inherited from class com.bigdata.service.FederationCallable |
|---|
getFederation, setFederation |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.bigdata.relation.rule.eval.IStepTask |
|---|
call |
| Methods inherited from interface com.bigdata.service.IFederationCallable |
|---|
getFederation, setFederation |
| Field Detail |
|---|
protected static final transient org.apache.log4j.Logger log
protected final ActionEnum action
protected final IJoinNexusFactory joinNexusFactory
protected IIndexManager indexManager
protected final IStep step
| Constructor Detail |
|---|
protected AbstractStepTask(ActionEnum action,
IJoinNexusFactory joinNexusFactory,
IStep step,
IIndexManager indexManager,
DataService dataService)
ExecutorService
or to the ConcurrencyManager IFF the task was submitted to a
DataService.
Note: The DataService will notice the
IDataServiceCallable interface and set a reference to
itself using DataServiceCallable.setDataService(DataService). submit()
notices this case and causes this task to be clone()ed,
the ExecutorService set on the clone, and the clone is then
submitted to the ConcurrencyManager for the DataService.
action - Indicate whether this is a query or a mutation operation.joinNexusFactory - Various goodies.step - The rule or program.indexManager - dataService - non-null iff the caller is already running on
a DataService.
IllegalArgumentException - if action is null.
IllegalArgumentException - if joinNexusFactory is null.
IllegalArgumentException - if step is null.| Method Detail |
|---|
public String toString()
toString in class Object
protected RuleStats runParallel(IJoinNexus joinNexus,
IStep program,
List<Callable<RuleStats>> tasks)
throws InterruptedException,
ExecutionException
program - tasks -
InterruptedException
ExecutionExceptionClientIndexView code so that we notice all
errors, log them all, and report them all in a single thrown
exception. note that we may be running asynchronously inside of a
task after the caller has an iterator that is draining the buffer.
when an error occurs in that context the buffer should be flagged
to indicate an exception and closed and the iterator should report
the exception to the client.
Do the same thing for running a program as a sequence.
protected RuleStats runSequential(IJoinNexus joinNexus,
IStep program,
List<Callable<RuleStats>> tasks)
throws InterruptedException,
ExecutionException
program - tasks -
InterruptedException
ExecutionException
protected RuleStats runOne(IJoinNexus joinNexus,
IStep program,
Callable<RuleStats> task)
throws InterruptedException,
ExecutionException
Note: use #runOne(IStep, Callable) rather than either
#runParallel(IStep, List) or #runSequential(IStep, List)
when there is only one task to execute in order to avoid an unnecessary
layering of the RuleStats (this is due to a coupling between the
RuleStats reporting structure and the control structure for
executing the tasks).
program - tasks -
InterruptedException
ExecutionExceptionpublic Future<RuleStats> submit()
If we are executing on a DataService then DataServiceCallable.getDataService()
will have been set automatically and the task will be submitted to the
ConcurrencyManager for that DataService.
This condition occurs when this Callable is sent to the
DataService using DataService.submit(Callable). In order
to gain access to the named indices for the relation, we have to wrap up
this Callable as an AbstractTask that declares the
appropriate timestamp and resources. The AbstractTask is then
submitted to the ConcurrencyManager for execution. Once the
AbstractTask is actually running, the inner task
overrides the indexManager to be
AbstractTask.getJournal(). This provides access to the indices,
relations, etc. appropriate for the isolation level granted to the task
by the ConcurrencyManager - without this step the
AbstractTask will wind up using an IClientIndex view and
lose the benefits of access to unisolated indices.
public AbstractStepTask clone()
CloneNotSupportedException.
clone in class Objectprotected Set<String> getWriteRelationNames(IStep step)
protected Map<String,IRelation> getWriteRelations(IIndexManager indexManager,
IStep step,
long timestamp)
timestamp - The timestamp associated with the relation views on which the
rule(s) will write.
RuntimeException - if any relation can not be resolved.
protected Map<String,IRelation> getReadRelations(IIndexManager indexManager,
IStep step,
long timestamp)
RuntimeException - if any relation can not be resolved.
protected Map<String,IBuffer<ISolution[]>> getMutationBuffers(IJoinNexus joinNexus,
Map<String,IRelation> relations)
IMutableRelation.
IllegalStateException - if the program is being executed as mutation.
RuntimeException - If a rule requires mutation for a relation (it will write on
the relation) and the corresponding entry in the map does not
implement IMutableRelation.protected Set<String> getIndexNames(Collection<IRelation> c)
c - A collection of IRelations.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||