Enum RunOptions.Semantic

    • Enum Constant Detail

      • DISALLOW_EXISTING

        public static final RunOptions.Semantic DISALLOW_EXISTING
        If a transaction is already associated with the current thread a QuarkusTransactionException will be thrown, otherwise a new transaction is started, and follows all the normal lifecycle rules.
      • JOIN_EXISTING

        public static final RunOptions.Semantic JOIN_EXISTING

        If no transaction is active then a new transaction will be started, and committed when the method ends. If an exception is thrown the exception handler registered by RunOptions.exceptionHandler(Function) will be called to decide if the TX should be committed or rolled back.

        If an existing transaction is active then the method is run in the context of the existing transaction. If an exception is thrown the exception handler will be called, however a result of RunOptions.ExceptionResult.ROLLBACK will result in the TX marked as rollback only, while a result of RunOptions.ExceptionResult.COMMIT will result in no action being taken.

      • REQUIRE_NEW

        public static final RunOptions.Semantic REQUIRE_NEW
        This is the default semantic.

        If an existing transaction is already associated with the current thread then the transaction is suspended, and resumed once the current transaction is complete.

        A new transaction is started after the existing transaction is suspended, and follows all the normal lifecycle rules.

      • SUSPEND_EXISTING

        public static final RunOptions.Semantic SUSPEND_EXISTING
        If no transaction is active then this semantic is basically a no-op.

        If a transaction is active then it is suspended, and resumed after the task is run.

        The exception handler will never be consulted when this semantic is in use, specifying both an exception handler and this semantic is considered an error.

        This semantic allows for code to easily be run outside the scope of a transaction.

    • Method Detail

      • values

        public static RunOptions.Semantic[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (RunOptions.Semantic c : RunOptions.Semantic.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static RunOptions.Semantic valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null