/** * Remove the specified pending retry job from the cache * * @param owningProcess * @param index */ private void forget(String owningProcess, int[] index) { List<JobState> activeJobs = stateMap.get(owningProcess); for (JobState rs : new ArrayList<JobState>(activeJobs)) { if (identicalIndex(rs.jobEvent.getIndex(), index)) { activeJobs.remove(rs); } } }
/** * Remove the specified pending retry job from the cache * * @param owningProcess * Owning process identifier as returned by * {@link DispatchJobEvent#getOwningProcess()} * @param index * Index of the job as returned by * {@link DispatchJobEvent#getIndex()} */ protected void forget(String owningProcess, int[] index) { for (JobState jobState : getJobsCopy(owningProcess)) { if (identicalIndex(jobState.jobEvent.getIndex(), index)) { removeJob(owningProcess, jobState); return; } } logger.error("Could not forget " + Arrays.asList(index)); }
/** * Remove the specified pending retry job from the cache * * @param owningProcess * Owning process identifier as returned by * {@link DispatchJobEvent#getOwningProcess()} * @param index * Index of the job as returned by * {@link DispatchJobEvent#getIndex()} */ protected void forget(String owningProcess, int[] index) { for (JobState jobState : getJobsCopy(owningProcess)) { if (identicalIndex(jobState.jobEvent.getIndex(), index)) { removeJob(owningProcess, jobState); return; } } // It could be due to pipelining activities like BioMart logger.debug("Could not forget " + owningProcess + " " + Arrays.toString(index)); }
/** * If an error occurs we can either handle the error or send it to the layer * above for further processing. */ @Override public void receiveError(DispatchErrorEvent errorEvent) { List<JobState> activeJobs = stateMap.get(errorEvent.getOwningProcess()); // Take a copy of the list so we don't modify it while iterating over it for (JobState rs : new ArrayList<JobState>(activeJobs)) { if (identicalIndex(rs.jobEvent.getIndex(), errorEvent.getIndex())) { boolean handled = rs.handleError(); if (!handled) { activeJobs.remove(rs); getAbove().receiveError(errorEvent); return; } } } }
@Override public boolean handleError() { currentActivityIndex++; if (currentActivityIndex == jobEvent.getActivities().size()) { return false; } else { List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get( currentActivityIndex)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent.getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); return true; } } }
@Override @SuppressWarnings("unchecked") public boolean handleError() { currentActivityIndex++; if (currentActivityIndex == jobEvent.getActivities().size()) { return false; } else { List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get( currentActivityIndex)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent.getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); return true; } } }
@Override @SuppressWarnings("unchecked") public boolean handleError() { currentActivityIndex++; if (currentActivityIndex == jobEvent.getActivities().size()) { return false; } else { List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get( currentActivityIndex)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent.getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); return true; } } }
public void fail(String message, Throwable t, DispatchErrorType errorType) { logger.warn("Failed (" + errorType + ") invoking " + asyncActivity + " for job " + jobEvent + ": " + message, t); MonitorManager.getInstance().deregisterNode( invocationProcessIdentifier); getAbove().receiveError( new DispatchErrorEvent(jobEvent.getOwningProcess(), jobEvent.getIndex(), jobEvent.getContext(), message, t, errorType, asyncActivity)); }
/** * Receive a job from the layer above, store it in the state map then relay * it to the layer below with a modified activity list containing only the * activity at index 0 */ @Override public void receiveJob(DispatchJobEvent jobEvent) { addJobToStateList(jobEvent); List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get(0)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent .getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); }
/** * Receive a job from the layer above, store it in the state map then relay * it to the layer below with a modified activity list containing only the * activity at index 0 */ @SuppressWarnings("unchecked") @Override public void receiveJob(DispatchJobEvent jobEvent) { List<JobState> stateList = null; synchronized (stateMap) { stateList = stateMap.get(jobEvent.getOwningProcess()); if (stateList == null) { stateList = new ArrayList<JobState>(); stateMap.put(jobEvent.getOwningProcess(), stateList); } } stateList.add(getStateObject(jobEvent)); List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get(0)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent .getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); }
public void fail(String message, Throwable t, DispatchErrorType errorType) { logger.warn("Failed (" + errorType + ") invoking " + asyncActivity + " for job " + jobEvent + ": " + message, t); MonitorManager.getInstance().deregisterNode( invocationProcessIdentifier); getAbove().receiveError( new DispatchErrorEvent(jobEvent.getOwningProcess(), jobEvent.getIndex(), jobEvent.getContext(), message, t, errorType, asyncActivity)); }
/** * Receive a job from the layer above, store it in the state map then relay * it to the layer below with a modified activity list containing only the * activity at index 0 */ @SuppressWarnings("unchecked") @Override public void receiveJob(DispatchJobEvent jobEvent) { addJobToStateList(jobEvent); List<Activity<?>> newActivityList = new ArrayList<Activity<?>>(); newActivityList.add(jobEvent.getActivities().get(0)); getBelow().receiveJob( new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent .getIndex(), jobEvent.getContext(), jobEvent.getData(), newActivityList)); }
public void fail(String message, Throwable t, DispatchErrorType errorType) { MonitorManager.getInstance().deregisterNode( invocationProcessIdentifier); getAbove().receiveError( new DispatchErrorEvent(jobEvent .getOwningProcess(), jobEvent .getIndex(), jobEvent.getContext(), message, t, errorType, as)); }
/** * If an error occurs we can either handle the error or send it to the layer * above for further processing. */ @Override public void receiveError(DispatchErrorEvent errorEvent) { String owningProcess = errorEvent.getOwningProcess(); List<JobState> activeJobs = getJobsCopy(owningProcess); for (JobState rs : activeJobs) { if (identicalIndex(rs.jobEvent.getIndex(), errorEvent.getIndex())) { boolean handled = rs.handleError(); if (!handled) { removeJob(owningProcess, rs); getAbove().receiveError(errorEvent); return; } } } }
/** * If an error occurs we can either handle the error or send it to the layer * above for further processing. */ @Override public void receiveError(DispatchErrorEvent errorEvent) { String owningProcess = errorEvent.getOwningProcess(); List<JobState> activeJobs = getJobsCopy(owningProcess); for (JobState rs : activeJobs) { if (identicalIndex(rs.jobEvent.getIndex(), errorEvent.getIndex())) { boolean handled = rs.handleError(); if (!handled) { removeJob(owningProcess, rs); getAbove().receiveError(errorEvent); return; } } } }