com.bigdata.journal
Class AbstractTask.DelegateTask<T>

java.lang.Object
  extended by com.bigdata.journal.AbstractTask.DelegateTask<T>
All Implemented Interfaces:
ITask<T>, Callable<T>
Direct Known Subclasses:
AbstractTask.InnerReadWriteTxServiceCallable, AbstractTask.InnerWriteServiceCallable
Enclosing class:
AbstractTask<T>

protected abstract static class AbstractTask.DelegateTask<T>
extends Object
implements ITask<T>

Delegates various behaviors visible to the application code using the ITask interface to the AbstractTask object.

Author:
Bryan Thompson

Field Summary
protected  AbstractTask<T> delegate
           
 
Constructor Summary
protected AbstractTask.DelegateTask(AbstractTask<T> delegate)
           
 
Method Summary
 IIndex getIndex(String name)
          Return an appropriate view of the named index for the operation.
 IJournal getJournal()
          The journal against which the operation will be carried out.
 String getOnlyResource()
          Return the only declared resource.
 String[] getResource()
          Returns a copy of the array of resources declared to the constructor.
 IResourceManager getResourceManager()
          The object used to manage access to the resources from which views of the indices are created.
 TaskCounters getTaskCounters()
          The object used to track events and times for the task.
 String toString()
          Returns Task{taskName,timestamp,resource[]}
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.concurrent.Callable
call
 

Field Detail

delegate

protected final AbstractTask<T> delegate
Constructor Detail

AbstractTask.DelegateTask

protected AbstractTask.DelegateTask(AbstractTask<T> delegate)
Method Detail

getResourceManager

public IResourceManager getResourceManager()
Description copied from interface: ITask
The object used to manage access to the resources from which views of the indices are created.

Specified by:
getResourceManager in interface ITask<T>

getJournal

public IJournal getJournal()
Description copied from interface: ITask
The journal against which the operation will be carried out.

If the task is running against an ITx.UNISOLATED index, then this will be the IResourceManager.getLiveJournal(). If the operation is a historical read, then it will be whatever journal is appropriate to the historical commit point against which the task is being run.

Note: For ITx.UNISOLATED operations this exposes unconstrained access to the journal that could be used to violate the concurrency control mechanisms, therefore you SHOULD NOT use this unless you have a clear idea what you are about. You should be able to write all application level tasks in terms of ITask.getIndex(String) and operations on the returned index.

Note: For example, if you use the returned object to access a named index and modify the state of that named index, your changes WILL NOT be noticed by the checkpoint protocol in AbstractTask.InnerWriteServiceCallable.

Specified by:
getJournal in interface ITask<T>
Returns:
The corresponding journal for that timestamp -or- null if no journal has data for that timestamp, including when a historical journal with data for that timestamp has been deleted.
See Also:
IResourceManager.getJournal(long)

getResource

public String[] getResource()
Description copied from interface: ITask
Returns a copy of the array of resources declared to the constructor.

Specified by:
getResource in interface ITask<T>

getOnlyResource

public String getOnlyResource()
Description copied from interface: ITask
Return the only declared resource.

Specified by:
getOnlyResource in interface ITask<T>
Returns:
The declared resource.

getIndex

public IIndex getIndex(String name)
Description copied from interface: ITask
Return an appropriate view of the named index for the operation.

When the task is isolated by a transaction, then the index will be isolated by the transaction using the appropriate isolation level. If the transaction is read-only, then the index will not be writable.

When the task is a read-only unisolated operation, the index will be read-only and will read from the most recent committed state of the store prior to the time at which the task began to execute. If multiple index views are requested they will all use the same committed state of the store.

When the task is an unisolated write operation the index will be the unisolated writable (aka "live" or "current" index). Access to the unisolated writable indices is single-threaded. This constraint is enforced by a lock system using the named resources declared in the task constructor.

Specified by:
getIndex in interface ITask<T>
Parameters:
name - The index name.
Returns:
An appropriate view of the named index.

getTaskCounters

public TaskCounters getTaskCounters()
Description copied from interface: ITask
The object used to track events and times for the task.

Specified by:
getTaskCounters in interface ITask<T>

toString

public String toString()
Description copied from interface: ITask
Returns Task{taskName,timestamp,resource[]}

Specified by:
toString in interface ITask<T>
Overrides:
toString in class Object


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