Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.util
Interface TransactionMap.Validator

All Known Implementing Classes:
  SimpleValidator

Enclosing interface:
  TransactionMap

    public static interface TransactionMap.Validator

A callback interface used by TransactionMap implementations.

By providing an implementation of this interface, it is possible to provide alternative strategies for verifying the correctness of concurrent execution of transactions.

Method Summary
`void` | `enlist(TransactionMap mapTx, java.lang.Object oKey)` Enlist the resource with the specified transaction.
`TransactionMap.Validator` | `getNextValidator()` Retrive the next Validator.
`void` | `setNextValidator(TransactionMap.Validator v)` Set the next Validator.
`void` | `validate(TransactionMap mapTx, java.util.Set setInsert, java.util.Set setUpdate, java.util.Set setDelete, java.util.Set setRead, java.util.Set setPhantom)` Validate that the content of the TransactionMap is "fit" to be committed into the base map.

Method Detail

### enlist

    void enlist(TransactionMap mapTx,
                java.lang.Object oKey)

  Enlist the resource with the specified transaction.

  This method is invoked for all resources that are "used" by the transaction immediately before the resource value is copied into the local map.

  It is this method's responsibility to call a next Validator in the validation chain (i.e. `getNextValidator().enlist(map, okey);`)

  Parameters:
    `mapTx` - the TransactionMap to enlist the resource with
    `oKey` - the resource key to be enlisted with the transaction

### validate

    void validate(TransactionMap mapTx,
                  java.util.Set setInsert,
                  java.util.Set setUpdate,
                  java.util.Set setDelete,
                  java.util.Set setRead,
                  java.util.Set setPhantom)
                  throws java.util.ConcurrentModificationException

  Validate that the content of the TransactionMap is "fit" to be committed into the base map.

  This method is invoked during "prepare" phase after all the resources involved in this transaction are successfully locked at the base map. The Validator is expected to retrieve the "old" and "new" values (using `map.get(oKey)`, `map.getBaseMap().get(oKey)`) and use the information gathered during "enlist" calls to make the determination whether or not commit should be allowed to proceed.

  To force a roll back it should throw an exception indicating the reason this transaction cannot be committed. When that happens, the sets are expected to hold just the keys of the "offending" resources.

  It is this method's responsibility to call a next Validator in the validation chain (i.e. `getNextValidator().validate(map, setI, setU, setD, setR, setF);`)

  Parameters:
    `mapTx` - the TransactionMap that is being prepared
    `setInsert` - the set of inserted resources
    `setUpdate` - the set of updated resources
    `setDelete` - the set of deleted resources
    `setRead` - the set of read resources. It is always empty for TRANSACTION_GET_COMMITTED isolation level.
    `setPhantom` - the set of phantom resources, that is resources that were added to the base map, but were not known to the transaction. This set can be not empty only for TRANSACTION_GET_SERIALIZED isolation level.
  Throws:
    `java.util.ConcurrentModificationException` - if the validator detects an unresolveable conflict between the resources

### getNextValidator

    TransactionMap.Validator getNextValidator()

  Retrive the next Validator.

  Returns:
    the next Validator

### setNextValidator

    void setNextValidator(TransactionMap.Validator v)

  Set the next Validator. Note: This method cannot be called while in the middle of a validation (commit) phase.

  Parameters:
    `v` - the Validator to be added
  Throws:
    `java.lang.IllegalStateException` - if the next validator cannot be changed

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.