Fix default schema cache failures
We've these seen intermittent failures on jenkins:
Caused by: java.lang.IllegalArgumentException: Unable to create cache directory at cache/schema
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:210)
at org.opendaylight.yangtools.yang.model.repo.util.FilesystemSchemaSourceCache.<init>(FilesystemSchemaSourceCache.java:74)
at org.opendaylight.netconf.topology.AbstractNetconfTopology.<clinit>(AbstractNetconfTopology.java:149)
In FilesystemSchemaSourceCache"
if (!storageDirectory.exists()) {
checkArgument(storageDirectory.mkdirs(), "Unable to create cache directory at %s",
storageDirectory);
}
mkdirs returns false if the dir/file already exists - this seems the likely reason
in this case even though it checks exists() just prior. This scenario could happen
if there's a race where some other component interleaves and creates the dir in
between the exists and mkdirs calls.
To protect against this sceniario, AbstractNetconfTopology and NetconfTopologyUtils
were changed to retry if FilesystemSchemaSourceCache throws an IAE. Also they no
longer fail class initialization on failure.
Change-Id: I9f7ec134e7fd817aa753f0db175bf5620cc52ff4
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>