Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.util
Class TwoPhaseCommitTool

    java.lang.Object
      org.apache.lucene.util.TwoPhaseCommitTool

    public final class TwoPhaseCommitTool

extends Object

A utility for executing 2-phase commit on several objects.

See Also:
  `TwoPhaseCommit`
WARNING: This API is experimental and might change in incompatible ways in the next release.

Nested Class Summary
`static class` | `TwoPhaseCommitTool.CommitFailException` Thrown by `execute(TwoPhaseCommit...)` when an object fails to commit().
`static class` | `TwoPhaseCommitTool.PrepareCommitFailException` Thrown by `execute(TwoPhaseCommit...)` when an object fails to prepareCommit().
`static class` | `TwoPhaseCommitTool.TwoPhaseCommitWrapper` A wrapper of a `TwoPhaseCommit`, which delegates all calls to the wrapped object, passing the specified commitData.

Constructor Summary
`TwoPhaseCommitTool()`

Method Summary
`static void` | `execute(TwoPhaseCommit... objects)` Executes a 2-phase commit algorithm by first `TwoPhaseCommit.prepareCommit()` all objects and only if all succeed, it proceeds with `TwoPhaseCommit.commit()`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### TwoPhaseCommitTool

    public TwoPhaseCommitTool()

Method Detail

### execute

    public static void execute(TwoPhaseCommit... objects)
                        throws TwoPhaseCommitTool.PrepareCommitFailException,
                               TwoPhaseCommitTool.CommitFailException

  Executes a 2-phase commit algorithm by first `TwoPhaseCommit.prepareCommit()` all objects and only if all succeed, it proceeds with `TwoPhaseCommit.commit()`. If any of the objects fail on either the preparation or actual commit, it terminates and `TwoPhaseCommit.rollback()` all of them.

  NOTE: it may happen that an object fails to commit, after few have already successfully committed. This tool will still issue a rollback instruction on them as well, but depending on the implementation, it may not have any effect.

  NOTE: if any of the objects are `null`, this method simply skips over them.

  Throws:
    `TwoPhaseCommitTool.PrepareCommitFailException` - if any of the objects fail to `TwoPhaseCommit.prepareCommit()`
    `TwoPhaseCommitTool.PrepareCommitFailException` - if any of the objects fail to `TwoPhaseCommit.commit()`
    `TwoPhaseCommitTool.CommitFailException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD