Created
November 5, 2016 14:22
-
-
Save dragos/6ce3065e685b0f48ed07af9a8454f002 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnsimeActor(langServer: EnsimeLanguageServer, config: EnsimeConfig) extends Actor with LazyLogging { | |
private var project: ActorRef = _ | |
override val supervisorStrategy = OneForOneStrategy(5, 1 minute) { | |
case e @ ActorInitializationException(actor, message, cause) => | |
logger.error(s"Actor failed to initialize", e) | |
langServer.connection.logMessage(MessageType.Error, s"Error starting ensime: $message") | |
SupervisorStrategy.Restart | |
case e => | |
logger.error(s"Actor crashed: ", e) | |
SupervisorStrategy.Restart | |
} | |
override def receive = { | |
case message => | |
if (project eq null) { | |
logger.info("Starting problematic actor now") | |
project = context.actorOf(Props(classOf[EnsimeProjectServer], langServer, config), "ensimeProject") | |
} | |
project forward message | |
} | |
} |
Author
dragos
commented
Nov 5, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment