com.bigdata.relation.rule.eval
Class MutationTask

java.lang.Object
  extended by com.bigdata.service.FederationCallable<T>
      extended by com.bigdata.service.DataServiceCallable<RuleStats>
          extended by com.bigdata.relation.rule.eval.AbstractStepTask
              extended by com.bigdata.relation.rule.eval.MutationTask
All Implemented Interfaces:
IStepTask, IDataServiceCallable, IFederationCallable, Serializable, Cloneable, Callable<RuleStats>

public class MutationTask
extends AbstractStepTask

A task that executes a mutation operation.

Version:
$Id: MutationTask.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.bigdata.relation.rule.eval.AbstractStepTask
action, indexManager, joinNexusFactory, log, step
 
Constructor Summary
protected MutationTask(ActionEnum action, IJoinNexusFactory joinNexusFactory, IStep step, IIndexManager indexManager, DataService dataService)
           
 
Method Summary
 RuleStats call()
          Run the task.
protected  void flushBuffers(IJoinNexus joinNexus, Map<String,IBuffer<ISolution[]>> buffers)
          Flush the buffer(s) and aggregate the mutation count from each buffer.
protected  long getMutationCountFromBuffers(RuleStats totals, Map<String,IBuffer<ISolution[]>> buffers)
          This just reads off and aggregates the mutationCount from each buffer as reported by IBuffer.flush().
protected  List<Callable<RuleStats>> newMutationTasks(IStep step, IJoinNexus joinNexus, Map<String,IBuffer<ISolution[]>> buffers)
          Builds a set of tasks for the program.
 
Methods inherited from class com.bigdata.relation.rule.eval.AbstractStepTask
clone, getIndexNames, getMutationBuffers, getReadRelations, getWriteRelationNames, getWriteRelations, runOne, runParallel, runSequential, submit, 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.service.IFederationCallable
getFederation, setFederation
 

Constructor Detail

MutationTask

protected MutationTask(ActionEnum action,
                       IJoinNexusFactory joinNexusFactory,
                       IStep step,
                       IIndexManager indexManager,
                       DataService dataService)
Method Detail

call

public RuleStats call()
               throws Exception
Run the task.

Note: We can create the individual tasks that we need to execute now that we are in the correct execution context.

Note: The mutation tasks write on IBuffers and those buffers flush to indices in the IMutableRelations. We have to defer the creation of those buffers until we are in the execution context and have access to the correct indices. In turn, this means that we can not create the tasks that we are going to execute until we have those buffers on hand. Hence everything gets deferred until we are in the correct execution context and have the actual IIndexManager with which the tasks will execute.

Throws:
Exception

flushBuffers

protected void flushBuffers(IJoinNexus joinNexus,
                            Map<String,IBuffer<ISolution[]>> buffers)
                     throws InterruptedException,
                            ExecutionException
Flush the buffer(s) and aggregate the mutation count from each buffer. This is the actual mutation count for the step(s) executed by the MutationTask (no double-counting).

Throws:
InterruptedException
ExecutionException

getMutationCountFromBuffers

protected long getMutationCountFromBuffers(RuleStats totals,
                                           Map<String,IBuffer<ISolution[]>> buffers)
This just reads off and aggregates the mutationCount from each buffer as reported by IBuffer.flush(). This is the actual mutation count for the step(s) executed by the MutationTask (no double-counting).

Note: The buffers SHOULD already have been flushed as this does NOT parallelise the writes on the IMutableRelations. See #flushBuffers(IJoinNexus, RuleStats, Map), which does parallelize those writes.

Returns:
The mutation count, which was also set as a side-effect on totals.

newMutationTasks

protected List<Callable<RuleStats>> newMutationTasks(IStep step,
                                                     IJoinNexus joinNexus,
                                                     Map<String,IBuffer<ISolution[]>> buffers)
Builds a set of tasks for the program.

Parameters:
buffers -
Returns:


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.