Class AbstractBackgroundTask

    • Constructor Detail

      • AbstractBackgroundTask

        public AbstractBackgroundTask()
    • Method Detail

      • execute

        public final void execute​(String display,
                                  String context)
        Description copied from interface: BackgroundTask
        Executes the background task with the given context. The given display name is used on logs.
        Specified by:
        execute in interface BackgroundTask
      • doExecute

        protected abstract long doExecute​(String context)
        Must be implemented to actually execute the task logic, returning the number of affected records
      • runInEntityNetwork

        protected <T> T runInEntityNetwork​(SimpleEntity entity,
                                           Supplier<T> action)
        Runs the given runnable in the entity's network, if any. Otherwise runs directly.
      • runInNetwork

        protected <T> T runInNetwork​(Network network,
                                     Supplier<T> action)
        Runs the runnable in the given network.