com.bigdata.journal
Class JournalTransactionService.SinglePhaseCommit

java.lang.Object
  extended by com.bigdata.journal.AbstractTask<Void>
      extended by com.bigdata.journal.JournalTransactionService.SinglePhaseCommit
All Implemented Interfaces:
ITask<Void>, Callable<Void>
Enclosing class:
JournalTransactionService

public static class JournalTransactionService.SinglePhaseCommit
extends AbstractTask<Void>

This task is an UNISOLATED operation that validates and commits a transaction known to have non-empty write sets.

Note: DO NOT Tx.lock while you submit this task as it could cause a deadlock if there is a task ahead of you in the queue for the same tx!

NOte: DO NOT use this task for a distributed transaction (one with writes on more than one DataService) since it will fail to obtain a coherent commit time for the transaction as a whole.

Version:
$Id: JournalTransactionService.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Nested Class Summary
 
Nested classes/interfaces inherited from class com.bigdata.journal.AbstractTask
AbstractTask.DelegateTask<T>, AbstractTask.InnerReadWriteTxServiceCallable, AbstractTask.InnerWriteServiceCallable<T>, AbstractTask.ResubmitException
 
Field Summary
 
Fields inherited from class com.bigdata.journal.AbstractTask
checkpointNanoTime, concurrencyManager, DEBUG, INFO, isReadWriteTx, log, nanoTime_assignedWorker, nanoTime_beginWork, nanoTime_finishedWork, nanoTime_submitTask, readOnly, resourceManager, taskCounters, timestamp, transactionManager, tx
 
Constructor Summary
JournalTransactionService.SinglePhaseCommit(IConcurrencyManager concurrencyManager, ILocalTransactionManager localTransactionManager, Tx state)
           
 
Method Summary
 Void doTask()
          Implement the task behavior here.
 
Methods inherited from class com.bigdata.journal.AbstractTask
assertResource, assertRunning, assertUnisolated, call, clearLoggingContext, dropIndex, getCommitTime, getIndex, getJournal, getOnlyResource, getResource, getResourceManager, getTaskCounters, getTaskName, getTimestamp, isResource, registerIndex, setupLoggingContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JournalTransactionService.SinglePhaseCommit

public JournalTransactionService.SinglePhaseCommit(IConcurrencyManager concurrencyManager,
                                                   ILocalTransactionManager localTransactionManager,
                                                   Tx state)
Method Detail

doTask

public Void doTask()
            throws Exception
Description copied from class: AbstractTask
Implement the task behavior here.

Note: Long-running implementations MUST periodically test Thread.interrupted() and MUST throw an exception, such as InterruptedException, if they are interrupted. This behavior allows tasks to be canceled in a timely manner.

If you ignore or fail to test Thread.interrupted() then your task CAN NOT be aborted. If it is Future.cancel(boolean) with false then the task will run to completion even though it has been cancelled (but the Future will appear to have been cancelled).

If you simply return rather than throwing an exception then the WriteExecutorService will assume that your task completed and your (partial) results will be made restart-safe at the next commit!

Specified by:
doTask in class AbstractTask<Void>
Returns:
The object that will be returned by AbstractTask.call() iff the operation succeeds.
Throws:
Exception - The exception that will be thrown by AbstractTask.call() iff the operation fails.
InterruptedException - This exception SHOULD be thrown if Thread.interrupted() becomes true during execution.


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