com.sun.jini.mahalo
Class PrepareAndCommitJob

java.lang.Object
  extended by com.sun.jini.mahalo.Job
      extended by com.sun.jini.mahalo.PrepareAndCommitJob
All Implemented Interfaces:
TransactionConstants

public class PrepareAndCommitJob
extends Job
implements TransactionConstants

An implementation of a Job which interacts with a set of TransactionParticipants to inform them to vote and roll forward/back changes associated with a given Transaction.

Author:
Sun Microsystems, Inc.
See Also:
Job, ParticipantTask, Transaction, TransactionParticipant

Field Summary
(package private)  ParticipantHandle handle
           
(package private)  ClientLog log
           
(package private)  int maxtries
           
private  boolean notifyClient
           
private static Logger operationsLogger
          Logger for operations related messages
private static Logger persistenceLogger
          Logger for persistence related messages
private  RemoteException reCaught
           
(package private)  ServerTransaction tr
           
 
Fields inherited from class com.sun.jini.mahalo.Job
attempts, logger, results
 
Fields inherited from interface net.jini.core.transaction.server.TransactionConstants
ABORTED, ACTIVE, COMMITTED, NOTCHANGED, PREPARED, VOTING
 
Constructor Summary
PrepareAndCommitJob(Transaction tr, TaskManager pool, WakeupManager wm, ClientLog log, ParticipantHandle handle)
          Constructs a PrepareAndCommitJob.
 
Method Summary
(package private)  Object computeResult()
          Gathers partial results submitted by tasks and produces a single outcome.
(package private)  TaskManager.Task[] createTasks()
          Creates the TaskManager.Tasks necessary to inform participants to vote and roll-forward/back.
(package private)  Object doWork(TaskManager.Task who, Object param)
          The work to be performed by each TaskManager.Task is provided by the Job that creates it.
(package private)  Exception getAlternateException()
          Simple accessor that returns the the exception to send back to the client.
 
Methods inherited from class com.sun.jini.mahalo.Job
attempt, getMgr, getPool, isCompleted, performWork, scheduleTasks, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tr

ServerTransaction tr

log

ClientLog log

handle

ParticipantHandle handle

maxtries

int maxtries

reCaught

private volatile RemoteException reCaught

notifyClient

private volatile boolean notifyClient

operationsLogger

private static final Logger operationsLogger
Logger for operations related messages


persistenceLogger

private static final Logger persistenceLogger
Logger for persistence related messages

Constructor Detail

PrepareAndCommitJob

public PrepareAndCommitJob(Transaction tr,
                           TaskManager pool,
                           WakeupManager wm,
                           ClientLog log,
                           ParticipantHandle handle)
Constructs a PrepareAndCommitJob.

Parameters:
tr - The Transaction whose participants will be instructed to vote and roll-forward/back.
pool - The TaskManager which provides the threads used for interacting with participants.
log - The ClientLog used for recording recovery data.
handle - The array of participants which will be contacted and informed to vote and roll-forward/back.
See Also:
TaskManager, ClientLog, TransactionParticipant
Method Detail

doWork

Object doWork(TaskManager.Task who,
              Object param)
The work to be performed by each TaskManager.Task is provided by the Job that creates it. The work performed by a task belonging to the CommitJob contacts a participant, instructs it to vote, roll-forward/back and log appropriately.

Specified by:
doWork in class Job
Parameters:
who - The task performing the work
param - A parameter, of the task's choosing, useful in performing work.
See Also:
Job, TaskManager.Task

createTasks

TaskManager.Task[] createTasks()
Creates the TaskManager.Tasks necessary to inform participants to vote and roll-forward/back.

Specified by:
createTasks in class Job

computeResult

Object computeResult()
               throws JobException
Gathers partial results submitted by tasks and produces a single outcome.

Specified by:
computeResult in class Job
Throws:
JobException
See Also:
Job

getAlternateException

Exception getAlternateException()
Simple accessor that returns the the exception to send back to the client.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.