Interface IAutoSaveAware

    • Method Detail

      • isAutoSaveEnabled

        boolean isAutoSaveEnabled()
        Returns:
        true if auto save is enabled, false otherwise.
      • beginWithoutAutoSave

        void beginWithoutAutoSave()
        Start doing something without auto save.
      • endWithoutAutoSave

        void endWithoutAutoSave()
        End doing something without auto save. It must be ensure that each call to beginWithoutAutoSave() is always correctly ended with a call to this method.
      • performWithoutAutoSave

        default void performWithoutAutoSave​(@Nonnull
                                            Runnable aRunnable)
        This method is used for batch processing of instructions (like the initial read). If first turns automatic saving off, runs the desired operations and finally restores the initial state of the "automatic save" flag and tries to write any pending changes.
        Parameters:
        aRunnable - The runnable to be executed. May not be null.
      • performWithoutAutoSave

        @Nullable
        default <RETURNTYPE> RETURNTYPE performWithoutAutoSave​(@Nonnull
                                                               Supplier<RETURNTYPE> aCallable)
        This method is used for batch processing of instructions (like the initial read). If first turns automatic saving off, runs the desired operations and finally restores the initial state of the "automatic save" flag and tries to write any pending changes.
        Type Parameters:
        RETURNTYPE - Return type of the callable
        Parameters:
        aCallable - The runnable to be executed. May not be null.
        Returns:
        the result of the callable.
      • performWithoutAutoSaveThrowing

        default <EXTYPE extends Exception> void performWithoutAutoSaveThrowing​(@Nonnull
                                                                               com.helger.commons.callback.IThrowingRunnable<EXTYPE> aRunnable)
                                                                        throws EXTYPE extends Exception
        Execute a callback with autosave being disabled. Must be called outside a writeLock, as this method locks itself!
        Type Parameters:
        EXTYPE - Exception type that may be thrown
        Parameters:
        aRunnable - The callback to be executed
        Throws:
        EXTYPE - In case of an error
        EXTYPE extends Exception
      • performWithoutAutoSaveThrowing

        @Nullable
        default <RETURNTYPE,​EXTYPE extends Exception> RETURNTYPE performWithoutAutoSaveThrowing​(@Nonnull
                                                                                                      com.helger.commons.functional.IThrowingSupplier<RETURNTYPE,​EXTYPE> aCallable)
                                                                                               throws EXTYPE extends Exception
        Execute a callback with autosave being disabled. Must be called outside a writeLock, as this method locks itself!
        Type Parameters:
        RETURNTYPE - Return type of the callable
        EXTYPE - Exception type that may be thrown
        Parameters:
        aCallable - The callback to be executed
        Returns:
        The result of the callback. May be null.
        Throws:
        EXTYPE - In case of an error
        EXTYPE extends Exception