fixed the cap managment of the command state queue
- added a thread for schedule the check of the command state queue
  to execute the cap