順序の実行

前の項で作成した順序を実行するには、TableAPI.execute()メソッドを使用します。

package kvstore.basicExample;
try {
    tableH.execute(opList, null);
} catch (OperationExecutionException oee) {
    // Some error occurred that prevented the sequence
    // from executing successfully. Use
    // oee.getFailedOperationIndex() to determine which
    // operation failed. Use oee.getFailedOperationResult()
    // to obtain an OperationResult object, which you can
    // use to troubleshoot the cause of the execution
    // exception.
} catch (IllegalArgumentException iae) {
    // An operation in the list was null or empty.

    // Or at least one operation operates on a row
    // with a shard key that is different
    // than the others.

    // Or more than one operation uses the same key.
} catch (DurabilityException de) {
    // The durability guarantee could not be met.
} catch (RequestTimeoutException rte) {
    // The operation was not completed inside of the
    // default request timeout limit.
} catch (FaultException fe) {
    // A generic error occurred
} 

前述の例外のいずれかがスローされると、順序全体が中止され、データは、順序を実行しなかった場合の状態になることに注意してください。

TableAPI.execute()はオプションでWriteOptionsクラス・インスタンスを取得できます。このクラス・インスタンスでは、次のものを指定できます。

WriteOptionsの使用の例は、「永続性保証」を参照してください。