@@ -57,7 +57,7 @@ public class DefaultTaskExecutor implements TaskExecutor
57
57
58
58
private final IntSupplier getParallelism ;
59
59
60
- public DefaultTaskExecutor ( ExecutorService executorService )
60
+ public DefaultTaskExecutor ( final ExecutorService executorService )
61
61
{
62
62
this .executorService = executorService ;
63
63
this .getParallelism = initGetParallelism ();
@@ -89,9 +89,9 @@ public int getParallelism()
89
89
}
90
90
91
91
@ Override
92
- public void runAll ( List < Runnable > tasks )
92
+ public void runAll ( final List < Runnable > tasks )
93
93
{
94
- List < Callable < Object > > callables = new ArrayList <>( tasks .size () );
94
+ final List < Callable < Object > > callables = new ArrayList <>( tasks .size () );
95
95
// use for-loop because stream with collect(Collectors.toList) is slow.
96
96
for ( Runnable task : tasks )
97
97
callables .add ( Executors .callable ( task ) );
@@ -106,9 +106,9 @@ public int suggestNumberOfTasks()
106
106
}
107
107
108
108
@ Override
109
- public < T > void forEach ( List < ? extends T > parameters , Consumer < ? super T > task )
109
+ public < T > void forEach ( final List < ? extends T > parameters , final Consumer < ? super T > task )
110
110
{
111
- List < Callable < Object > > callables = new ArrayList <>( parameters .size () );
111
+ final List < Callable < Object > > callables = new ArrayList <>( parameters .size () );
112
112
// use for-loop because stream with collect(Collectors.toList) is slow.
113
113
for ( T parameter : parameters )
114
114
callables .add ( () -> {
@@ -121,14 +121,14 @@ public < T > void forEach( List< ? extends T > parameters, Consumer< ? super T >
121
121
@ Override
122
122
public < T , R > List < R > forEachApply ( List < ? extends T > parameters , Function < ? super T , ? extends R > task )
123
123
{
124
- List < Callable < R > > callables = new ArrayList <>( parameters .size () );
124
+ final List < Callable < R > > callables = new ArrayList <>( parameters .size () );
125
125
// use for-loop because stream with collect(Collectors.toList) is slow.
126
126
for ( T parameter : parameters )
127
127
callables .add ( () -> task .apply ( parameter ) );
128
128
try
129
129
{
130
- List < Future < R > > futures = executorService .invokeAll ( callables );
131
- List < R > results = new ArrayList <>( futures .size () );
130
+ final List < Future < R > > futures = executorService .invokeAll ( callables );
131
+ final List < R > results = new ArrayList <>( futures .size () );
132
132
for ( Future < R > future : futures )
133
133
results .add ( future .get () );
134
134
return results ;
@@ -139,11 +139,11 @@ public < T, R > List< R > forEachApply( List< ? extends T > parameters, Function
139
139
}
140
140
}
141
141
142
- private void invokeAllIgnoreResults ( List < Callable < Object > > callables )
142
+ private void invokeAllIgnoreResults ( final List < Callable < Object > > callables )
143
143
{
144
144
try
145
145
{
146
- List < Future < Object > > futures = executorService .invokeAll ( callables );
146
+ final List < Future < Object > > futures = executorService .invokeAll ( callables );
147
147
for ( Future < Object > future : futures )
148
148
future .get ();
149
149
}
0 commit comments