org.apache.lucene.util
Class TwoPhaseCommitTool.TwoPhaseCommitWrapper

java.lang.Object
  extended by org.apache.lucene.util.TwoPhaseCommitTool.TwoPhaseCommitWrapper
All Implemented Interfaces:
TwoPhaseCommit
Enclosing class:
TwoPhaseCommitTool

public static final class TwoPhaseCommitTool.TwoPhaseCommitWrapper
extends Object
implements TwoPhaseCommit

A wrapper of a TwoPhaseCommit, which delegates all calls to the wrapped object, passing the specified commitData. This object is useful for use with TwoPhaseCommitTool.execute(TwoPhaseCommit...) if one would like to store commitData as part of the commit.


Constructor Summary
TwoPhaseCommitTool.TwoPhaseCommitWrapper(TwoPhaseCommit tpc, Map<String,String> commitData)
           
 
Method Summary
 void commit()
          The second phase of a 2-phase commit.
 void commit(Map<String,String> commitData)
          Like TwoPhaseCommit.commit(), but takes an additional commit data to be included w/ the commit.
 void prepareCommit()
          The first stage of a 2-phase commit.
 void prepareCommit(Map<String,String> commitData)
          Like TwoPhaseCommit.commit(), but takes an additional commit data to be included w/ the commit.
 void rollback()
          Discards any changes that have occurred since the last commit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TwoPhaseCommitTool.TwoPhaseCommitWrapper

public TwoPhaseCommitTool.TwoPhaseCommitWrapper(TwoPhaseCommit tpc,
                                                Map<String,String> commitData)
Method Detail

prepareCommit

public void prepareCommit()
                   throws IOException
Description copied from interface: TwoPhaseCommit
The first stage of a 2-phase commit. Implementations should do as much work as possible in this method, but avoid actual committing changes. If the 2-phase commit fails, TwoPhaseCommit.rollback() is called to discard all changes since last successful commit.

Specified by:
prepareCommit in interface TwoPhaseCommit
Throws:
IOException

prepareCommit

public void prepareCommit(Map<String,String> commitData)
                   throws IOException
Description copied from interface: TwoPhaseCommit
Like TwoPhaseCommit.commit(), but takes an additional commit data to be included w/ the commit.

NOTE: some implementations may not support any custom data to be included w/ the commit and may discard it altogether. Consult the actual implementation documentation for verifying if this is supported.

Specified by:
prepareCommit in interface TwoPhaseCommit
Throws:
IOException
See Also:
TwoPhaseCommit.prepareCommit()

commit

public void commit()
            throws IOException
Description copied from interface: TwoPhaseCommit
The second phase of a 2-phase commit. Implementations should ideally do very little work in this method (following TwoPhaseCommit.prepareCommit(), and after it returns, the caller can assume that the changes were successfully committed to the underlying storage.

Specified by:
commit in interface TwoPhaseCommit
Throws:
IOException

commit

public void commit(Map<String,String> commitData)
            throws IOException
Description copied from interface: TwoPhaseCommit
Like TwoPhaseCommit.commit(), but takes an additional commit data to be included w/ the commit.

Specified by:
commit in interface TwoPhaseCommit
Throws:
IOException
See Also:
TwoPhaseCommit.commit(), TwoPhaseCommit.prepareCommit(Map)

rollback

public void rollback()
              throws IOException
Description copied from interface: TwoPhaseCommit
Discards any changes that have occurred since the last commit. In a 2-phase commit algorithm, where one of the objects failed to TwoPhaseCommit.commit() or TwoPhaseCommit.prepareCommit(), this method is used to roll all other objects back to their previous state.

Specified by:
rollback in interface TwoPhaseCommit
Throws:
IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.