File tree 1 file changed +7
-0
lines changed
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,8 @@ Threads and Executors
143
143
- [ Thread is named?] ( #name-threads )
144
144
- [ Can use ` ExecutorService ` instead of creating a new ` Thread ` each time some method is called?
145
145
] ( #reuse-threads )
146
+ - [ ` ExecutorService ` s are * not* created within short-lived objects (but rather reused)?
147
+ ] ( #reuse-threads )
146
148
- [ No network I/O in a CachedThreadPool?] ( #cached-thread-pool-no-io )
147
149
- [ No blocking (incl. I/O) operations in a ` ForkJoinPool ` or in a parallel Stream pipeline?
148
150
] ( #fjp-no-blocking )
@@ -1137,6 +1139,11 @@ whether a `ThreadGroup` should be specified. Many of such rules can be effective
1137
1139
** ` new Thread(...).start() ` ** , in some methods that may be called repeatedly? Is it possible to
1138
1140
delegate the work to a cached or a shared ` ExecutorService ` instead?
1139
1141
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
+
1140
1147
<a name =" cached-thread-pool-no-io " ></a >
1141
1148
[ #] ( #cached-thread-pool-no-io ) TE.3. ** Aren’t some network I/O operations performed in an
1142
1149
` Executors.newCachedThreadPool() ` -created ` ExecutorService ` ?** If a machine that runs the
You can’t perform that action at this time.
0 commit comments