Migrate users of Optional.get()
[controller.git] / opendaylight / config / threadpool-config-impl / src / main / java / org / opendaylight / controller / config / threadpool / util / FlexibleThreadPoolWrapper.java
index 9949e36d3714f55b6936e66d3d596ef9a5b9b96c..d56765d1bba88a35786e6cdbb81481108dbe49d3 100644 (file)
@@ -52,9 +52,8 @@ public class FlexibleThreadPoolWrapper implements ThreadPool, Closeable {
      * This impl saturates threadpool first, then queue. When both are full caller will get blocked.
      */
     private static ForwardingBlockingQueue getQueue(final OptionalInt capacity) {
-        final BlockingQueue<Runnable> delegate = capacity.isPresent() ? new LinkedBlockingQueue<>(capacity.getAsInt())
-                : new LinkedBlockingQueue<>();
-        return new ForwardingBlockingQueue(delegate);
+        return new ForwardingBlockingQueue(
+            capacity.isPresent() ? new LinkedBlockingQueue<>(capacity.orElseThrow()) : new LinkedBlockingQueue<>());
     }
 
     @Override