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

## com.atomikos.icatch
Interface Participant

All Superinterfaces:
  Serializable

All Known Implementing Classes:
  CoordinatorImp, MessageParticipant, ReadOnlyParticipant, RollbackOnlyParticipant, SubTransactionCoordinatorParticipant, XAResourceTransaction

    public interface Participant

extends Serializable

A participant for 2PC of composite transactions. Implementations can be added as a 2PC participant in the icatch kernel. VERY IMPORTANT: implementations should also override the default `equals` and `hashCode` methods, in order for 2PC to work!

Field Summary
`static int` | `READ_ONLY` Indicates that no commit/rollback needed after prepare.

Method Summary
`HeuristicMessage[]` | `commit(boolean onePhase)` Commit the participant's work.
`void` | `forget()` Indicate that a heuristic participant can forget about its work.
`HeuristicMessage[]` | `getHeuristicMessages()` Get any heuristic messages so far.
`String` | `getURI()` Gets a unique URI for this participant.
`int` | `prepare()` Prepare the participant.
`boolean` | `recover()` Recover this instance.
`HeuristicMessage[]` | `rollback()` Rollback the participant's work.
`void` | `setCascadeList(Dictionary allParticipants)` For cascading 2PC, this method sets the information needed to cascade.
`void` | `setGlobalSiblingCount(int count)` Set by the root coordinator: the total no of siblings detected.

Field Detail

### READ_ONLY

    static final int READ_ONLY

  Indicates that no commit/rollback needed after prepare.

  See Also:
    Constant Field Values

Method Detail

### recover

    boolean recover()
                    throws SysException

  Recover this instance. Called by the transaction manager (TM) at recovery time, and this should reconstruct the internal state.

  Returns:
    boolean False iff the instance could not be recovered. It is up to the TM to determine the severity of this case.
  Throws:
    `SysException` - On failure.

### getURI

    String getURI()

  Gets a unique URI for this participant. Local participants should merely return null.

  Returns:
    String The URI for this participant, or null if not applicable.

### setCascadeList

    void setCascadeList(Dictionary allParticipants)
                        throws SysException

  For cascading 2PC, this method sets the information needed to cascade. This method is relevant only for transaction monitors; leave empty otherwise!

  Parameters:
    `allParticipants` - The information needed by the transaction monitor for
  Throws:
    `SysException` - For unexpected failures.

### setGlobalSiblingCount

    void setGlobalSiblingCount(int count)

  Set by the root coordinator: the total no of siblings detected. This method is relevant only for transaction monitors; leave empty otherwise!

  Parameters:
    `count` - The global count.

### prepare

    int prepare()
                throws RollbackException,
                       HeurHazardException,
                       HeurMixedException,
                       SysException

  Prepare the participant. Any locks for this participant's work should be recoverable (either saved to an external file OR be part of the instance's non-transient state so that they can be flushed into the transaction manager's log).

  Returns:
    int If this is READ_ONLY, then no second round is needed. Participants that return this value on prepare will not be called by commit or rollback afterwards.
  Throws:
    `RollbackException` - For a NO vote. This indicates that the participant has already rolled back (or marked for rollback) the work on behalf of this participant.
    `HeurHazardException` - On possible conflicts. This happens for remote participants instances, in case of communication failures.
    `HeurMixedException` - If some subordinate participants voted YES, timed out and committed heuristically whereas afterwards some NO votes where received.
    `SysException` - Unexpected errors.

### commit

    HeuristicMessage[] commit(boolean onePhase)
                              throws HeurRollbackException,
                                     HeurHazardException,
                                     HeurMixedException,
                                     RollbackException,
                                     SysException

  Commit the participant's work. NOTE: custom participant implementations should preferably be made for the server's local VM (e.g., it is better not to do this over RMI). Also, they should rely on the icatch transaction manager for heuristic timeout (and NOT decide to terminate heuristically themselves). In that case, implementations never need to throw any of the heuristic exceptions of this method.

  Parameters:
    `onePhase` - If true, one-phase commit is being started. If the participant has received a prepare call earlier, then it should throw a SysException here.
  Returns:
    HeuristicMessage[] An array of messages, null if none.
  Throws:
    `HeuristicRollbackException` - If the participant has rolled back.
    `HeuristicMixedException` - If part of it was rolled back.
    `HeurHazardException` - On possible conflicts.
    `RollbackException` - In case of one-phase commit, and the transaction has been rolled back at the time commit is called.
    `SysException` - Unexpected failure.
    `HeurRollbackException`
    `HeurMixedException`

### rollback

    HeuristicMessage[] rollback()
                                throws HeurCommitException,
                                       HeurMixedException,
                                       HeurHazardException,
                                       SysException

  Rollback the participant's work. NOTE: custom participant implementations should preferably be made for the server's local VM (e.g., it is better not to do this over RMI). Also, they should rely on the icatch transaction manager for heuristic timeout (and NOT decide to terminate heuristically themselves). In that case, implementations never need to throw any of the heuristic exceptions of this method.

  Returns:
    HeuristicMessage[] An array of messages, null if none.
  Throws:
    `HeurCommitException` - If the participant committed.
    `HeurHazardException` - If the participant's final state is unsure.
    `HeurMixedException` - If part of it was rolled back.
    `SysException` - Unexpected failure.

### forget

    void forget()

  Indicate that a heuristic participant can forget about its work. If implementations rely on the transaction manager to decide when to do heuristics (rather then deciding in the participant implementation), then leave this method empty.

### getHeuristicMessages

    HeuristicMessage[] getHeuristicMessages()

  Get any heuristic messages so far. The transaction manager used this method to get information after preparing this participant.

  Returns:
    HeuristicMessage[] An array of heuristic messages, or null if none.

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

Copyright © 2012. All Rights Reserved.