Executors enhancement

Christian Schulte cs at schulte.it
Sun Aug 14 01:49:30 UTC 2016


Am 08/09/16 um 19:04 schrieb ecki at zusammenkunft.net:
> So it is a good idea to find a good shared default, but an API quite
> seldomly can isolate itself and the users about those aspects. So always
> allow to provide an alternate Executor. This also helps with thread
> naming, thread context, interceptors and error handlers.

That way?


    /**
     * Gets the {@code ExecutorService} used to run tasks in parallel.
     * <p>
     * The {@code ExecutorService} used to run tasks in parallel is an
optional entity. If no such service is
     * provided by an application, no parallelization is performed.
Configuration or lifecycle management of that
     * {@code ExecutorService} is the responsibility of the application.
     * </p>
     *
     * @return The {@code ExecutorService} used to run tasks in
parallel, or {@code null}.
     *
     * @since 1.10
     */
    public final ExecutorService getExecutorService()
    {
        return this.executorService;
    }

    /**
     * Sets the {@code ExecutorService} to be used to run tasks in parallel.
     *
     * @param value The {@code ExecutorService} to be used to run tasks
in parallel, or {@code null}, to not make use
     * of any parallelization.
     *
     * @since 1.10
     */
    public final void setExecutorService( final ExecutorService value )
    {
        this.executorService = value;
    }

Regards,
-- 
Christian



More information about the core-libs-dev mailing list