/** * Add a command and it's callbacks to the list of commands to retry after login. * * @param command * command to retry * @param deferred * callbacks for the command */ private void afterLogin(GwtCommand command, Deferred deferred) { String token = notNull(command.getUserToken()); if (!afterLoginCommands.containsKey(token)) { afterLoginCommands.put(token, new ArrayList<RetryCommand>()); } afterLoginCommands.get(token).add(new RetryCommand(command, deferred)); }
public void onTokenChanged(TokenChangedEvent event) { setToken(event.getToken(), event.getUserDetail(), false); List<RetryCommand> retryCommands = afterLoginCommands.remove(oldToken); if (null != retryCommands) { for (RetryCommand retryCommand : retryCommands) { execute(retryCommand.getCommand(), retryCommand.getDeferred()); } } } });