Fire and Forget - Runnable Tasks

suggest change

Executors accept a java.lang.Runnable which contains (potentially computationally or otherwise long-running or heavy) code to be run in another Thread.

Usage would be:

Executor exec = anExecutor;
exec.execute(new Runnable() {
    @Override public void run() {
        //offloaded work, no need to get result back
    }
});

Note that with this executor, you have no means to get any computed value back.

With Java 8, one can utilize lambdas to shorten the code example.

Executor exec = anExecutor;
exec.execute(() -> {
    //offloaded work, no need to get result back
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Executor, ExecutorService and Thread pools:
* Fire and Forget - Runnable Tasks

Table Of Contents
8 Arrays
10 Maps
11 Strings
23 Executor, ExecutorService and Thread pools
25 JAXB
29 Enums
32 Audio
41 Scanner
63 Logging
75 Lists
78 Sets
89 JAX-WS
96 XJC
98 Process
106 Modules
114 Applets
122 JNDI
139 JavaBean
141 Literals
144 Packages
150 JMX
153 JShell
159 Sockets
167 Enum Map
175 Hashtable
177 SortedMap