private Timer createTimer ( ) { Timer fileTimer = new Timer ( ) ; // if the age limit is 0 or negative, treat it as "no limit". if ( ageLimit >= 0 ) { fileTimer . schedule ( new CloseFileTimerTask ( ) , ageLimit ) ; } return fileTimer ; }
Create the timer and schedule a task that will let us know when the file is too old to continue . If the age limit is 0 or negative we treat it as no limit .