sync
This commit is contained in:
parent
2f564c6b20
commit
9e2c092fc4
@ -103,7 +103,7 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
|
||||
|
||||
def connectionUrl: String = s"${serverAddr.getCanonicalHostName}:$portNum"
|
||||
|
||||
override def start(): Unit = {
|
||||
override def start(): Unit = synchronized {
|
||||
super.start()
|
||||
if (!isStarted) {
|
||||
val thread = new Thread(this)
|
||||
@ -122,7 +122,7 @@ class FrontendService private (name: String, be: BackendService, oomHook: Runnab
|
||||
System.exit(-1)
|
||||
}
|
||||
|
||||
override def stop(): Unit = {
|
||||
override def stop(): Unit = synchronized {
|
||||
if (isStarted) {
|
||||
server.foreach(_.stop())
|
||||
info(this.name + " has stopped")
|
||||
|
||||
@ -56,7 +56,7 @@ trait ProcBuilder {
|
||||
|
||||
@volatile private var error: Throwable = UNCAUGHT_ERROR
|
||||
|
||||
final def start: Process = {
|
||||
final def start: Process = synchronized {
|
||||
val procLog = Paths.get(workingDir.toAbsolutePath.toString, s"$module.log")
|
||||
processBuilder.redirectError(procLog.toFile)
|
||||
processBuilder.redirectOutput(procLog.toFile)
|
||||
@ -83,6 +83,8 @@ trait ProcBuilder {
|
||||
}
|
||||
} catch {
|
||||
case _: IOException =>
|
||||
} finally {
|
||||
reader.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +92,7 @@ trait ProcBuilder {
|
||||
proc
|
||||
}
|
||||
|
||||
def getError: Throwable = {
|
||||
def getError: Throwable = synchronized {
|
||||
if (error == UNCAUGHT_ERROR) {
|
||||
Thread.sleep(3000)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user