build-in server: ability to disable it via VM options

GitOrigin-RevId: e9e9668c863ae9742dbb4d8ff89f04e80289c653
This commit is contained in:
Anton Makeev
2020-05-11 13:49:16 +00:00
committed by intellij-monorepo-bot
parent 1a3c2669bc
commit cad68898e2
@@ -31,11 +31,13 @@ import java.net.InetAddress
import java.net.NetworkInterface
import java.net.URLConnection
import java.util.*
import java.util.concurrent.CompletableFuture
import java.util.concurrent.Future
import java.util.function.Consumer
private const val PORTS_COUNT = 20
private const val PROPERTY_RPC_PORT = "rpc.port"
private const val PROPERTY_DISABLED = "idea.builtin.server.disabled"
private val LOG = logger<BuiltInServerManager>()
@@ -123,6 +125,12 @@ class BuiltInServerManagerImpl : BuiltInServerManager() {
}
private fun startServerInPooledThread(): Future<*> {
if (SystemProperties.getBooleanProperty(PROPERTY_DISABLED, false)) {
return CompletableFuture<Any>().apply {
completeExceptionally(Throwable("Built-in server is disabled by `$PROPERTY_DISABLED` VM option"))
}
}
return StartupUtil.getServerFuture()
.thenAcceptAsync(Consumer { mainServer ->
try {