dCache/dcache — pull request #348 by gbehrmann (2013-12-09 10:19:42+00:00)
Title: pool: Fix race condition in migration module

Addresses an IllegalStateException in migration module.

The following exception can occur:

java.lang.IllegalStateException: Unexpected source pool list: Exactly one item was expected, but it contained 0
at org.dcache.pool.migration.PoolListFilter.getSource(PoolListFilter.java:116) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.PoolListFilter.evaluate(PoolListFilter.java:126) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.PoolListFilter.isExcluded(PoolListFilter.java:101) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.PoolListFilter.getPools(PoolListFilter.java:76) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.Task.getPools(Task.java:195) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.Task.setLocations(Task.java:266) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.Task.access$000(Task.java:38) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.Task$1.success(Task.java:253) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.pool.migration.Task$1.success(Task.java:249) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.cells.AbstractMessageCallback.success(AbstractMessageCallback.java:31) ~[dcache-core-2.6.17.jar:2.6.17]
at org.dcache.cells.CellStub$CellCallback.answerArrived(CellStub.java:416) ~[dcache-core-2.6.17.jar:2.6.17]
at dmg.cells.nucleus.CellNucleus$CallbackTask.innerRun(CellNucleus.java:983) ~[cells-2.6.17.jar:2.6.17]
at dmg.cells.nucleus.CellNucleus$AbstractNucleusTask.run(CellNucleus.java:941) ~[cells-2.6.17.jar:2.6.17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_17]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_17]

The problem occurs if migration module queries information about itself
from pool manager before pool manager has registered that information.
In that case a valid, but empty, reply from pool manager is received
and a pre-condition check in the migration module fails.

Target: trunk
Request: 2.7
Request: 2.6
Request: 2.2
Require-notes: yes
Require-book: no
Acked-by: Tigran Mkrtchyan
Acked-by: Paul Millar
Patch: http://rb.dcache.org/r/6283/
(cherry picked from commit 641a6443bf040bd137eed7c3915f6a5178926bef)