Source:
<code>private void registerDolphinPlatformDefaultCommands() { dolphin.register(new DolphinServerAction() { @Override public void registerIn(ActionRegistry registry) { registry.register(PlatformConstants.REGISTER_CONTROLLER_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onRegisterController(); } }); registry.register(PlatformConstants.DESTROY_CONTROLLER_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onDestroyController(); } }); registry.register(PlatformConstants.CALL_CONTROLLER_ACTION_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { <START> final ServerControllerActionCallBean bean = platformBeanRepository.getControllerActionCallBean(); <END> try { onInvokeControllerAction(bean); } catch (Exception e) { LOG.error("Unexpected exception while invoking action on controller {}", bean.getActionName(), bean.getControllerId(), e); bean.setError(true); } } }); registry.register(PlatformConstants.POLL_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onPollEventBus(); } }); registry.register(PlatformConstants.RELEASE_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onReleaseEventBus(); } }); registry.register(PlatformConstants.INIT_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { platformBeanRepository = new ServerPlatformBeanRepository(dolphin, beanRepository, dispatcher); } }); registry.register(PlatformConstants.DISCONNECT_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { } }); } }); }</code><technical_language>check platformBeanRepository != null throw Exception shows initialization done right way..</technical_language>

Target:
private void registerDolphinPlatformDefaultCommands() { dolphin.register(new DolphinServerAction() { @Override public void registerIn(ActionRegistry registry) { registry.register(PlatformConstants.REGISTER_CONTROLLER_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onRegisterController(); } }); registry.register(PlatformConstants.DESTROY_CONTROLLER_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onDestroyController(); } }); registry.register(PlatformConstants.CALL_CONTROLLER_ACTION_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { if (platformBeanRepository == null) { throw new IllegalStateException("An action was called before the init-command was sent."); } final ServerControllerActionCallBean bean = platformBeanRepository.getControllerActionCallBean(); try { onInvokeControllerAction(bean); } catch (Exception e) { LOG.error("Unexpected exception while invoking action on controller {}", bean.getActionName(), bean.getControllerId(), e); bean.setError(true); } } }); registry.register(PlatformConstants.POLL_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onPollEventBus(); } }); registry.register(PlatformConstants.RELEASE_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { onReleaseEventBus(); } }); registry.register(PlatformConstants.INIT_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { platformBeanRepository = new ServerPlatformBeanRepository(dolphin, beanRepository, dispatcher); } }); registry.register(PlatformConstants.DISCONNECT_COMMAND_NAME, new CommandHandler() { @Override public void handleCommand(Command command, List response) { } }); } }); }