File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ Threads and Executors
143143 - [ Thread is named?] ( #name-threads )
144144 - [ Can use ` ExecutorService ` instead of creating a new ` Thread ` each time some method is called?
145145 ] ( #reuse-threads )
146+ - [ ` ExecutorService ` s are * not* created within short-lived objects (but rather reused)?
147+ ] ( #reuse-threads )
146148 - [ No network I/O in a CachedThreadPool?] ( #cached-thread-pool-no-io )
147149 - [ No blocking (incl. I/O) operations in a ` ForkJoinPool ` or in a parallel Stream pipeline?
148150 ] ( #fjp-no-blocking )
@@ -1137,6 +1139,11 @@ whether a `ThreadGroup` should be specified. Many of such rules can be effective
11371139** ` new Thread(...).start() ` ** , in some methods that may be called repeatedly? Is it possible to
11381140delegate the work to a cached or a shared ` ExecutorService ` instead?
11391141
1142+ A weaker form of this problem is when a ** ` Thread ` (or an ` ExecutorService ` ) is created and managed
1143+ within objects (in other words, [ active objects] ( https://en.wikipedia.org/wiki/Active_object ) ) that
1144+ are relatively short-lived.** Is it possible to reuse executors by creating them one level up the
1145+ stack and passing shared executors to constructors of the short-lived objects?
1146+
11401147<a name =" cached-thread-pool-no-io " ></a >
11411148[ #] ( #cached-thread-pool-no-io ) TE.3. ** Aren’t some network I/O operations performed in an
11421149` Executors.newCachedThreadPool() ` -created ` ExecutorService ` ?** If a machine that runs the
You can’t perform that action at this time.
0 commit comments