@Test public void testAddJobTracker() throws Exception { final String old = System.getProperty( Const.KETTLE_MAX_JOB_TRACKER_SIZE ); final Integer maxTestSize = 30; try { System.setProperty( Const.KETTLE_MAX_JOB_TRACKER_SIZE, maxTestSize.toString() ); JobMeta jobMeta = mock( JobMeta.class ); JobTracker jobTracker = new JobTracker( jobMeta ); for ( int n = 0; n < maxTestSize * 2; n++ ) { jobTracker.addJobTracker( mock( JobTracker.class ) ); } assertTrue( "More JobTrackers than allowed were added", jobTracker.getTotalNumberOfItems() <= maxTestSize ); } finally { if ( old == null ) { System.clearProperty( Const.KETTLE_MAX_JOB_TRACKER_SIZE ); } else { System.setProperty( Const.KETTLE_MAX_JOB_TRACKER_SIZE, old ); } } }
public void addJobTracker( JobTracker jobTracker ) { lock.writeLock().lock(); try { jobTrackers.add( jobTracker ); while ( jobTrackers.size() > maxChildren ) { jobTrackers.removeFirst(); } } finally { lock.writeLock().unlock(); } }
JobTracker { public void addJobTracker( JobTracker jobTracker ) { lock.writeLock().lock(); try { jobTrackers.add( jobTracker ); while ( jobTrackers.size() > maxChildren ) { jobTrackers.removeFirst(); } } finally { lock.writeLock().unlock(); } } }
JobTracker { public void addJobTracker( JobTracker jobTracker ) { lock.writeLock().lock(); try { jobTrackers.add( jobTracker ); while ( jobTrackers.size() > maxChildren ) { jobTrackers.removeFirst(); } } finally { lock.writeLock().unlock(); } } JobTracker( JobMeta jobMeta );  JobTracker( JobMeta jobMeta, int maxChildren );  JobTracker( JobMeta jobMeta, JobEntryResult result );  JobTracker( JobMeta jobMeta, int maxChildren, JobEntryResult result ); }
JobTracker { public void addJobTracker( JobTracker jobTracker ) { lock.writeLock().lock(); try { jobTrackers.add( jobTracker ); while ( jobTrackers.size() > maxChildren ) { jobTrackers.removeFirst(); } } finally { lock.writeLock().unlock(); } } JobTracker( JobMeta jobMeta );  JobTracker( JobMeta jobMeta, int maxChildren );  JobTracker( JobMeta jobMeta, JobEntryResult result );  JobTracker( JobMeta jobMeta, int maxChildren, JobEntryResult result ); void addJobTracker( JobTracker jobTracker ); JobTracker getJobTracker( int i ); int nrJobTrackers(); List<JobTracker> getJobTrackers(); void setJobTrackers( List<JobTracker> jobTrackers ); JobEntryResult getJobEntryResult(); void setJobEntryResult( JobEntryResult result ); void clear(); JobTracker findJobTracker( JobEntryCopy jobEntryCopy ); JobTracker getParentJobTracker(); void setParentJobTracker( JobTracker parentJobTracker ); int getTotalNumberOfItems(); String getJobFilename(); void setJobFilename( String jobFilename ); String getJobName(); void setJobName( String jobName ); int getMaxChildren(); void setMaxChildren( int maxChildren ); }
JobTracker { public void addJobTracker( JobTracker jobTracker ) { lock.writeLock().lock(); try { jobTrackers.add( jobTracker ); while ( jobTrackers.size() > maxChildren ) { jobTrackers.removeFirst(); } } finally { lock.writeLock().unlock(); } } JobTracker( JobMeta jobMeta );  JobTracker( JobMeta jobMeta, int maxChildren );  JobTracker( JobMeta jobMeta, JobEntryResult result );  JobTracker( JobMeta jobMeta, int maxChildren, JobEntryResult result ); void addJobTracker( JobTracker jobTracker ); JobTracker getJobTracker( int i ); int nrJobTrackers(); List<JobTracker> getJobTrackers(); void setJobTrackers( List<JobTracker> jobTrackers ); JobEntryResult getJobEntryResult(); void setJobEntryResult( JobEntryResult result ); void clear(); JobTracker findJobTracker( JobEntryCopy jobEntryCopy ); JobTracker getParentJobTracker(); void setParentJobTracker( JobTracker parentJobTracker ); int getTotalNumberOfItems(); String getJobFilename(); void setJobFilename( String jobFilename ); String getJobName(); void setJobName( String jobName ); int getMaxChildren(); void setMaxChildren( int maxChildren );  }