Java Reference
In-Depth Information
Additionally, as mentioned earlier, we will stop the thread for 5 seconds so that we can
observe the execution later [4] .
We've got our building blocks in place. Now, it is time to combine them into a working
example. We can revisit our PendingSeats class from the beginning of this chapter, as
shown in the following code:
package com.packtpub.wflydevelopment.chapter12.external;
public class PendingSeats {
private final Queue<Long> seats =
new ConcurrentLinkedQueue<
private ManagedExecutorService executorService; // [1]
@Inject // [2]
private Instance<GenerateSeatRequestsFromDatabase>
private Instance<GenerateSeatRequestFromArtificial>
private Logger logger;
private void setUp() {
try {
List<Future<List<Integer>>> futures =
databaseCollector.get(), artificalCollector.get()
)); // [3]
Search WWH ::

Custom Search