@Override public boolean removeActionById(@NotNull String actionId) { Iterator<ActionStore.PendingAction> iter = actions.iterator(); while (iter.hasNext()) { ActionStore.PendingAction action = iter.next(); if (isInSources(action) && actionId.equals( action.clientAction != null ? action.clientAction.getActionId() : action.serverAction != null ? action.serverAction.getActionId() : null)) { // TODO should this send out an event? // This would affect the ActionConnectionPanel. Right now ActionConnectionPanel // just refreshes on its own, rather than waiting for these events. iter.remove(); return true; } } return false; }
@NotNull public String getActionId() { if (client != null) { return client.getActionId(); } if (server != null) { return server.getActionId(); } throw new IllegalStateException("unreachable code"); }
@NotNull static State getState(String sourceId, @NotNull P4CommandRunner.ServerAction<?> action) { State ret = new State(); ret.sourceId = sourceId; ret.actionId = action.getActionId(); ret.serverActionCmd = action.getCmd(); ret.clientActionCmd = null; ret.data = new PrimitiveMap(); switch (action.getCmd()) { case CREATE_JOB: ret.data.putP4Job("job", ((CreateJobAction) action).getJob()); break; case LOGIN: throw new IllegalArgumentException("Should not attempt to store a submit action"); default: throw new IllegalArgumentException("Unknown server cmd " + action.getCmd()); } return ret; }
added.serverAction.getActionId().equals(existing.serverAction.getActionId())) { if (LOG.isDebugEnabled()) { LOG.debug("Skipping duplicate action " + added.serverAction);
@Override public void serverActionUpdate(@NotNull ServerActionCacheMessage.Event event) { try { if (event.getState() == ServerActionCacheMessage.ActionState.PENDING) { // Add the event pendingCache.writeActions(event.getServerName(), (store) -> store.addAction(event.getServerAction())); } else { // Remove the event pendingCache.writeActions(event.getServerName(), (store) -> store.removeActionById(event.getServerAction().getActionId())); } } catch (InterruptedException e) { InternalErrorMessage.send(project).cacheLockTimeoutError(new ErrorEvent<>(new VcsInterruptedException( SERVER_CACHE_TIMEOUT_MESSAGE, e))); } }
public String getActionId() { if (clientAction != null) { return clientAction.getActionId(); } assert serverAction != null; return serverAction.getActionId(); }