org.apache.tinkerpop.gremlin.structure

## Class Transaction.Workload<R>

- java.lang.Object
- - org.apache.tinkerpop.gremlin.structure.Transaction.Workload<R>

- Type Parameters:
    `R` - The type of the result from the unit of work.
  Enclosing interface:
    Transaction

  Deprecated.
  As of release 3.2.6, not replaced.

      @Deprecated
      public static class Transaction.Workload<R>
      extends Object

  A `Transaction.Workload` represents a unit of work constructed by the `Transaction.submit(Function)` method on the `Transaction` interface. The unit of work is a `Function` typically containing mutations to the `Graph`. The `Transaction.Workload` is responsible for executing the unit of work in the context of a retry strategy, such that a failed unit of work is rolled back and executed again until retries are exhausted or the unit of work succeeds with a commit operation.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `DEFAULT_DELAY_MS` Deprecated.
    `static int` | `DEFAULT_TRIES` Deprecated.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Workload(Graph g, Function<Graph,R> work)` Deprecated. Creates a new `Transaction.Workload` that will be tried to be executed within a transaction.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `R` | `attempt(BiFunction<Graph,Function<Graph,R>,R> retryStrategy)` Deprecated. Try to execute a `Transaction.Workload` with a mapper retry strategy.
    `R` | `exponentialBackoff()` Deprecated. Executes the `Transaction.Workload` with the default number of retries and with a exponentially increasing number of milliseconds between each retry using the default retry delay.
    `R` | `exponentialBackoff(int tries)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry using the default retry delay.
    `R` | `exponentialBackoff(int tries, long initialDelay)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry.
    `R` | `exponentialBackoff(int tries, long initialDelay, Set<Class> exceptionsToRetryOn)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry.
    `R` | `fireAndForget()` Deprecated. Executes the `Transaction.Workload` committing if possible and rolling back on failure.
    `R` | `oneAndDone()` Deprecated. Executes the `Transaction.Workload` committing if possible and rolling back on failure.
    `R` | `retry()` Deprecated. Executes the `Transaction.Workload` with the default number of retries and with the default number of milliseconds delay between each try.
    `R` | `retry(int tries)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with the default number of milliseconds delay between each try.
    `R` | `retry(int tries, long delay)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with a number of milliseconds delay between each try.
    `R` | `retry(int tries, long delay, Set<Class> exceptionsToRetryOn)` Deprecated. Executes the `Transaction.Workload` with a number of retries and with a number of milliseconds delay between each try and will only retry on the set of supplied exceptions.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_DELAY_MS

          public static final long DEFAULT_DELAY_MS

      Deprecated.
      See Also:
        Constant Field Values

    - #### DEFAULT_TRIES

          public static final int DEFAULT_TRIES

      Deprecated.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### Workload

          public Workload(Graph g,
                          Function<Graph,R> work)

      Deprecated.
      Creates a new `Transaction.Workload` that will be tried to be executed within a transaction.
      Parameters:
        `g` - The `Graph` instance on which the work will be performed.
        `work` - The work to be executed on the Graph instance which will optionally return a value.

  - ### Method Detail

    - #### attempt

          public R attempt(BiFunction<Graph,Function<Graph,R>,R> retryStrategy)

      Deprecated.
      Try to execute a `Transaction.Workload` with a mapper retry strategy.
      Parameters:
        `retryStrategy` - The first argument to this function is the Graph instance and the second is the encapsulated work to be performed. The function should ultimately return the result of the encapsulated work function.
      Returns:
        The result of the encapsulated work.

    - #### oneAndDone

          public R oneAndDone()

      Deprecated.
      Executes the `Transaction.Workload` committing if possible and rolling back on failure. On failure, an exception is reported.

    - #### fireAndForget

          public R fireAndForget()

      Deprecated.
      Executes the `Transaction.Workload` committing if possible and rolling back on failure. On failure no exception is reported.

    - #### retry

          public R retry()

      Deprecated.
      Executes the `Transaction.Workload` with the default number of retries and with the default number of milliseconds delay between each try.

    - #### retry

          public R retry(int tries)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with the default number of milliseconds delay between each try.

    - #### retry

          public R retry(int tries,
                         long delay)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with a number of milliseconds delay between each try.

    - #### retry

          public R retry(int tries,
                         long delay,
                         Set<Class> exceptionsToRetryOn)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with a number of milliseconds delay between each try and will only retry on the set of supplied exceptions. Exceptions outside of that set will generate a RuntimeException and immediately fail.

    - #### exponentialBackoff

          public R exponentialBackoff()

      Deprecated.
      Executes the `Transaction.Workload` with the default number of retries and with a exponentially increasing number of milliseconds between each retry using the default retry delay.

    - #### exponentialBackoff

          public R exponentialBackoff(int tries)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry using the default retry delay.

    - #### exponentialBackoff

          public R exponentialBackoff(int tries,
                                      long initialDelay)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry.

    - #### exponentialBackoff

          public R exponentialBackoff(int tries,
                                      long initialDelay,
                                      Set<Class> exceptionsToRetryOn)

      Deprecated.
      Executes the `Transaction.Workload` with a number of retries and with a exponentially increasing number of milliseconds between each retry. It will only retry on the set of supplied exceptions. Exceptions outside of that set will generate a `RuntimeException` and immediately fail.

Copyright © 2013–2019 Apache Software Foundation. All rights reserved.