/**
 
 */
package net.catpad.infobus;

/**
 * This item is the only one that has an access to its own service thread.
 * It will simply set this thread's doExit variable to true thus guaranteeing
 * that it will be the last item ever to be executed by this thread.
 
 @author Michael Gertelman
 *
 */
class ShutdownServiceThreadCommQueueItem extends CommQueueItem {

  /**
   @param serviceLauncher
   */
  ShutdownServiceThreadCommQueueItem(ServiceLauncher serviceLauncher) {
    super(serviceLauncher);
  }

  /* (non-Javadoc)
   * @see net.catpad.infobus.CommQueueItem#execute(net.catpad.infobus.ServiceId)
   */
  @Override
  public void execute(ServiceId serviceId)
      throws CannotExecuteCommQueueItemException {
    
    // This will set my own doExit variable to true
    serviceLauncher.stopServiceImmediately(serviceId);
  }

}