com.sun.sgs.impl.service.transaction
Class ProfileParticipantDetailImpl

java.lang.Object
  extended by com.sun.sgs.impl.service.transaction.ProfileParticipantDetailImpl
All Implemented Interfaces:
ProfileParticipantDetail

 class ProfileParticipantDetailImpl
extends Object
implements ProfileParticipantDetail

Simple implementation of ProfileParticipantDetail that is package-private and used by TransactionImpl to report detail associated with each participant.


Constructor Summary
ProfileParticipantDetailImpl(String participantName)
          Creates an instance of ProfileParticipantDetailImpl for the given named participant.
 
Method Summary
 long getAbortTime()
          Returns the length of time this participant spent aborting if the transaction failed to commit.
 long getCommitTime()
          Returns the length of time this participant spent committing.
 String getParticipantName()
          Returns the name of this participant.
 long getPrepareTime()
          Returns the length of time this participant spent preparing to commit, regardless of whether preparation succeeded.
(package private)  void setAborted(long time)
          Sets the detail as associated with a participant that has been aborted.
(package private)  void setCommitted(long time)
          Sets the detail as associated with a participant that has been committed successfully.
(package private)  void setCommittedDirectly(long time)
          Sets the detail as associated with a participant that has been directly committed successfully.
(package private)  void setPrepared(long time, boolean readOnlyParticipant)
          Sets the detail as associated with a participant that has been prepared successfully.
 boolean wasCommitted()
          Returns whether this participant was successfully committed.
 boolean wasCommittedDirectly()
          Returns whether this participant was called to prepare and commit in one step (via TransactionParticipant.prepareAndCommit).
 boolean wasPrepared()
          Returns whether this participant finished preparing to commit at the conclusion of the transaction.
 boolean wasReadOnly()
          Returns the vote that the participant returned from preparation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProfileParticipantDetailImpl

ProfileParticipantDetailImpl(String participantName)
Creates an instance of ProfileParticipantDetailImpl for the given named participant.

Parameters:
participantName - the name of the participant associated with this detail
Method Detail

getParticipantName

public String getParticipantName()
Returns the name of this participant.

Specified by:
getParticipantName in interface ProfileParticipantDetail
Returns:
the participant's name

wasPrepared

public boolean wasPrepared()
Returns whether this participant finished preparing to commit at the conclusion of the transaction.

Specified by:
wasPrepared in interface ProfileParticipantDetail
Returns:
true if this participant finished preparing, false otherwise

wasReadOnly

public boolean wasReadOnly()
Returns the vote that the participant returned from preparation. If wasPrepared is false, then this method's return value has no meaning and will always return false.

Specified by:
wasReadOnly in interface ProfileParticipantDetail
Returns:
true if the participant returned from preparation with a vote of read-only, false otherwise

wasCommitted

public boolean wasCommitted()
Returns whether this participant was successfully committed.

Specified by:
wasCommitted in interface ProfileParticipantDetail
Returns:
true if this participant committed, false otherwise

wasCommittedDirectly

public boolean wasCommittedDirectly()
Returns whether this participant was called to prepare and commit in one step (via TransactionParticipant.prepareAndCommit). If this returns true then both getPrepareTime and getCommitTime will return the same value, as they represent the same work. If the return from wasCommitted is false then the call to prepareAndCommit failed.

Specified by:
wasCommittedDirectly in interface ProfileParticipantDetail
Returns:
true if this participant was called directly to commit, false otherwise

getPrepareTime

public long getPrepareTime()
Returns the length of time this participant spent preparing to commit, regardless of whether preparation succeeded. If this participant was called to commit directly, then this is the time it took both to prepare to commit and to commit.

Specified by:
getPrepareTime in interface ProfileParticipantDetail
Returns:
the time in milliseconds this participant spent preparing to commit, or the time spent preparing and committing if called directly to commit

getCommitTime

public long getCommitTime()
Returns the length of time this participant spent committing. If the participant failed in preparing to commit, or if the transaction was aborted and therefore this participant never committed, then this method will always return 0. If this participant was called to commit directly, then this is the time it took both to prepare to commit and to commit.

Specified by:
getCommitTime in interface ProfileParticipantDetail
Returns:
the time in milliseconds this participant spent committing, or the time spent preparing and committing if called directly to commit

getAbortTime

public long getAbortTime()
Returns the length of time this participant spent aborting if the transaction failed to commit. If the transaction committed, then this method will always return 0.

Specified by:
getAbortTime in interface ProfileParticipantDetail
Returns:
the time in milliseconds this participant spent aborting

setPrepared

void setPrepared(long time,
                 boolean readOnlyParticipant)
Sets the detail as associated with a participant that has been prepared successfully. If readOnlyParticipant is true then none of the other mutator methods should be called after calling setPrepared.

Parameters:
time - the time in milliseconds that the participant spent preparing
readOnlyParticipant - whether preparation ended with the participant voting read-only

setCommitted

void setCommitted(long time)
Sets the detail as associated with a participant that has been committed successfully. None of the other mutator methods should be called after calling setCommitted.

Parameters:
time - the time in milliseconds that the participant spent committing

setCommittedDirectly

void setCommittedDirectly(long time)
Sets the detail as associated with a participant that has been directly committed successfully. None of the other mutator methods should be called after calling setCommittedDirectly.

Parameters:
time - the time in milliseconds that the participant spent preparing and committing

setAborted

void setAborted(long time)
Sets the detail as associated with a participant that has been aborted. None of the other mutator methods should be called after calling setAborted.

Parameters:
time - the time in milliseconds that the participant spent aborting

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved