boolean (@NotNull final UUID preloadedSessionId, @NotNull CmdlineRemoteProto.Message.ControllerMessage params) { boolean succeeded = false; final SessionData sessionData = mySessionDescriptors.get(preloadedSessionId); if (sessionData != null) { //noinspection SynchronizationOnLocalVariableOrMethodParameter synchronized (sessionData) { if (sessionData.state == SessionData.State.WAITING_PARAMS) { sessionData.state = SessionData.State.RUNNING; final Channel channel = sessionData.channel; if (channel != null && channel.isActive()) { sessionData.handler.buildStarted(preloadedSessionId); channel.writeAndFlush(CmdlineProtoUtil.toMessage(preloadedSessionId, params)); succeeded = true; } } else { if (sessionData.state == SessionData.State.INITIAL) { sessionData.params = params; succeeded = true; } } } } return succeeded; }