public void run(long millisBetweenPhases) {
        long time, sleepTime;
        
        this.stop = false;
        
        while(!stop && !this.finalStateAchieved()) {
            time = - System.currentTimeMillis();
            
            //Execute the handlers before running the phase
            for(RunEnvironmentEventsHandler handler: this.eventsHandler) {
                handler.beforeRunOnePhase();
            }
            
            //Run the environment one phase
            this.runOnePhase();
            
            //Execute the handlers after running the phase
            for(RunEnvironmentEventsHandler handler: this.eventsHandler) {
                handler.afterRunOnePhase();
            }
            
            time += System.currentTimeMillis();
            
            //Sleep the thread if necessary 
            sleepTime = millisBetweenPhases - time;
                        
            if(sleepTime > 0) {
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException ex) {}
            }
        }
        
        //Execute handlers if necessary
        if(this.finalStateAchieved()) {
            for(RunEnvironmentEventsHandler handler: this.eventsHandler) {
                handler.whenFinalStateAchieved();
            }
        }
    }