Exemplo n.º 1
0
void MessageQueueService::handle_CimServiceStop(CimServiceStop *req)
{
#ifdef MESSAGEQUEUESERVICE_DEBUG
   PEGASUS_STD(cout) << getQueueName() << "received STOP" << PEGASUS_STD(endl);
#endif
   // set the stopeed bit and update
   _capabilities |= module_capabilities::stopped;
   _make_response(req, async_results::CIM_STOPPED);
   // now tell the meta dispatcher we are stopped
   update_service(_capabilities, _mask);
}
Exemplo n.º 2
0
void MessageQueueService::handle_CimServiceStart(CimServiceStart *req)
{

#ifdef MESSAGEQUEUESERVICE_DEBUG
   PEGASUS_STD(cout) << getQueueName() << "received START" << PEGASUS_STD(endl);
#endif

   // clear the stoped bit and update
   _capabilities &= (~(module_capabilities::stopped));
   _make_response(req, async_results::OK);
   // now tell the meta dispatcher we are stopped
   update_service(_capabilities, _mask);

}
Exemplo n.º 3
0
void MessageQueue::enqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,"MessageQueue::enqueue()");

    PEGASUS_ASSERT(message != 0);

    PEG_TRACE((TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
        "Queue name: [%s], Message: [%s]",
        getQueueName(),
        MessageTypeToString(message->getType())));

    _messageList.insert_back(message);

    handleEnqueue();
    PEG_METHOD_EXIT();
}
Exemplo n.º 4
0
void MessageQueue::enqueue(Message* message)
{
    PEG_METHOD_ENTER(TRC_MESSAGEQUEUESERVICE,"MessageQueue::enqueue()");

    if (!message)
    {
        Tracer::trace(TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
                    "MessageQueue::enqueue failure");
        PEG_METHOD_EXIT();
        throw NullPointer();
    }

    PEG_TRACE_STRING( TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL3,
                      String("Queue name: ") + getQueueName() ) ;
    Tracer::trace   ( TRC_MESSAGEQUEUESERVICE,
                      Tracer::LEVEL3,
                      "Message: [%s, %d]",
                      MessageTypeToString(message->getType()),
                      message->getKey() );

    {
    AutoMutex autoMut(_mut);
    if (_back)
    {
        _back->_next = message;
        message->_prev = _back;
        message->_next = 0;
        _back = message;
    }
    else
    {
        _front = message;
        _back = message;
        message->_prev = 0;
        message->_next = 0;
    }
    message->_owner = this;

    _count++;
    Tracer::trace(TRC_MESSAGEQUEUESERVICE, Tracer::LEVEL4,
                  "MessageQueue::enqueue _queueId = %d, _count = %d", _queueId, _count);

    } // mutex unlocks here

    handleEnqueue();
    PEG_METHOD_EXIT();
}
Exemplo n.º 5
0
void ModuleController::_async_thread_exec(
   PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *),
   void *parm)
{
   ThreadStatus rc = PEGASUS_THREAD_OK;
   while ((rc=_thread_pool->allocate_and_awaken(parm, thread_func)) != PEGASUS_THREAD_OK)
   {
      if (rc == PEGASUS_THREAD_INSUFFICIENT_RESOURCES)
      	pegasus_yield();
      else
      {
 	Logger::put(Logger::STANDARD_LOG, System::CIMSERVER, Logger::TRACE,
            	"Not enough threads for the client's asynchronous thread function.");
	// ATTN:There is no category for 'ModuleController' traceing.
 	Tracer::trace(TRC_DISCARDED_DATA, Tracer::LEVEL2,
                "Could not allocate for %s a client's asynchronous thread.",
                getQueueName());
	break;
      }
   }
}