Merge pull request #239 from corda/clint-webserverstartupfix

Fixed the race condition in web server startup with the keystore creation.
This commit is contained in:
Clinton 2017-02-13 17:20:25 +00:00 committed by GitHub
commit 48c65ac5d2

View File

@ -24,7 +24,6 @@ import org.glassfish.jersey.server.ResourceConfig
import org.glassfish.jersey.server.ServerProperties
import org.glassfish.jersey.servlet.ServletContainer
import java.lang.reflect.InvocationTargetException
import java.net.InetAddress
import java.util.*
// TODO: Split into a separate module under client that packages into WAR formats.
@ -158,6 +157,12 @@ class WebServer(val config: FullNodeConfiguration) {
} catch (e: ActiveMQNotConnectedException) {
log.debug("Could not connect to ${config.artemisAddress} due to exception: ", e)
Thread.sleep(retryDelay)
// This error will happen if the server has yet to create the keystore
// Keep the fully qualified package name due to collisions with the Kotlin stdlib
// exception of the same name
} catch (e: java.nio.file.NoSuchFileException) {
log.debug("Tried to open a file that doesn't yet exist, retrying", e)
Thread.sleep(retryDelay)
}
}
}