void ShutdownService::_sendShutdownRequestToService(const char * serviceName)
{

   MessageQueueService* _mqs = static_cast<MessageQueueService*>(_controller);
   
   Array<Uint32> _services;
   Uint32 _queueId;
	 
   _mqs->find_services(String(serviceName), 0, 0, &_services);
   
   if (_services.size() == 0 )
   {
      // service not found, just return
      return;
   }
   _queueId = _services[0];

    // send a Stop (this is a legacy message that in some of the MQS does termination
    // of its internal stuff. Then follow it with a Stop (to open up its incoming queue),
    // and then with a AsyncIoctl::IO_CLOSE which closes the incoming queue.

    // All of these messages MUST be sequential. Do not use SendForget or SendAsync as those
    // are asynchronous and their receival is guaranteed to be undeterministic and possibly
    // out of sequence (which is something we do not want).

    CimServiceStop stop_message (_mqs->get_next_xid(),
						      NULL, 
						      _queueId, 
						      _controller->getQueueId(),
						      true);
    
     AutoPtr <AsyncReply> StopAsyncReply 
	(_controller->ClientSendWait ( *_client_handle,  _queueId, &stop_message));

    CimServiceStart start_message (_mqs->get_next_xid(),
							 NULL, 
							 _queueId, 
							 _controller->getQueueId(),
							 true);

     AutoPtr <AsyncReply> StartAsyncReply 
	(_controller->ClientSendWait ( *_client_handle,  _queueId, &start_message));

    AsyncIoctl close_request (_mqs->get_next_xid(),
					       NULL,
					       _queueId,
					       _controller->getQueueId(),
					       false,
					       AsyncIoctl::IO_CLOSE,
					       0, 
					       0);

     AutoPtr <AsyncReply> CloseAsyncReply 
	(_controller->ClientSendWait ( *_client_handle,  _queueId, &close_request));

    return;
}
Beispiel #2
0
void ShutdownService::_sendShutdownRequestToService(const char* serviceName)
{
    MessageQueueService* _mqs = static_cast<MessageQueueService*>(_controller);

    MessageQueue *queue = MessageQueue::lookup(serviceName);
    Uint32 _queueId;
    if (queue)
    {
        _queueId =  queue->getQueueId();
    }
    else
    {
        // service not found, just return
        return;
    }
    // send a Stop (this is a legacy message that in some of the MQS does
    // termination of its internal stuff. Then follow it with a Stop (to
    // open up its incoming queue), and then with a AsyncIoClose
    // which closes the incoming queue.

    // All of these messages MUST be sequential. Do not use SendForget or
    // SendAsync as those are asynchronous and their receipt is guaranteed
    // to be undeterministic and possibly out of sequence (which is something
    // we do not want).

    CimServiceStop stop_message(
        NULL,
        _queueId,
        _controller->getQueueId(),
        true);

    AutoPtr<AsyncReply> StopAsyncReply(
        _controller->ClientSendWait(_queueId, &stop_message));

    CimServiceStart start_message(
        NULL,
        _queueId,
        _controller->getQueueId(),
        true);

    AutoPtr <AsyncReply> StartAsyncReply(
        _controller->ClientSendWait(_queueId, &start_message));

    AsyncIoClose close_request(
        NULL,
        _queueId,
        _controller->getQueueId(),
        false);

    AutoPtr <AsyncReply> CloseAsyncReply(
        _controller->ClientSendWait(_queueId, &close_request));
}