Prefer more threads than deeper queue 31/7631/1
authorRobert Varga <robert.varga@pantheon.sk>
Tue, 3 Jun 2014 05:56:29 +0000 (07:56 +0200)
committerRobert Varga <robert.varga@pantheon.sk>
Tue, 3 Jun 2014 08:49:51 +0000 (10:49 +0200)
commit44d0a767828e9b523d3710db91cdda4e647d73f6
treed05683060e70b22a38ac84ac563ecc3357142b3c
parentb32547346fa8e91e9630051a7ee51b2c6d3608d7
Prefer more threads than deeper queue

ThreadPoolExecutor does not start spawning new threads until the
underlying queue's offer() method return false. This means that we would
completely fill the queue before kicking off more threads.

This patch introduces a ForwardingBlockingQueue, which always returns
false from offer(), thus forcing the threadpool to expand. The policy
then uses put() to schedule (or block on scheduling) the tasks.

Change-Id: I341f0ca7061f6b76ae1f3e049b12704f35140633
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/MDController.java