private TopLevelStepExecutionEntity getStepExecutionTopLevelFromJobExecutionIdAndStepName ( long jobExecutionId , String stepName ) { JobExecutionEntity jobExecution = data . executionInstanceData . get ( jobExecutionId ) ; // Copy list to avoid ConcurrentModificationException for ( StepThreadExecutionEntity stepExec : new ArrayList < StepThreadExecutionEntity > ( jobExecution . getStepThreadExecutions ( ) ) ) { if ( stepExec . getStepName ( ) . equals ( stepName ) ) { if ( stepExec instanceof TopLevelStepExecutionEntity ) { return ( TopLevelStepExecutionEntity ) stepExec ; } } } // Bad if we've gotten here. throw new IllegalStateException ( "Couldn't find top-level step execution for jobExecution = " + jobExecutionId + ", and stepName = " + stepName ) ; }
Not well - suited to factor out into an interface method since for JPA it s embedded in a tran typically