private synchronized void setStatus ( final DriverStatus toStatus ) { if ( this . driverStatus . isLegalTransition ( toStatus ) ) { this . driverStatus = toStatus ; } else { LOG . log ( Level . WARNING , "Illegal state transition: {0} -> {1}" , new Object [ ] { this . driverStatus , toStatus } ) ; } }
Helper method to set the status . This also checks whether the transition from the current status to the new one is legal .