This is a (second) command handler for onRestartR (the other handler is in ApplicationQuit I believe). It may be the case that this is okay if both handlers are always called. However, to date our use of command handlers has been that there is a single place in the code where they are handled. So I think that rather than implementing onRestartR you should handle the RestartStatusEvent. It has two states: RESTART_INITIATED and RESTART_COMPLETED. The former would match with onRestartR, the latter is invoked after the new R sessions has come to life.