Esempio n. 1
0
mama_status
wombatThrottle_destroy (wombatThrottle throttle)
{
    if (self == NULL)
        return MAMA_STATUS_OK;

    /* Acquire the lock before destroying the timer. */
    wlock_lock (self->mTimerLock);

    /* Destroy the timer. */
    if (self->mTimer != NULL)
    {
        mamaTimer_destroy (self->mTimer);
        self->mTimer = NULL;     
    }     

    /* Release the lock. */
    wlock_unlock (self->mTimerLock);

        /* Destroy the timer lock. */
    if (self->mTimerLock != NULL)
    {
        wlock_destroy (self->mTimerLock);
        self->mTimerLock = NULL;
    }

    
    wombatThrottle_cleanUp (throttle);

    return MAMA_STATUS_OK;
}
Esempio n. 2
0
static void MAMACALLTYPE
wombatThrottle_timerCB (mamaTimer timer, void *throttle)
{

    /* If mRate == 0, throttle has been deactivated. Finish any remaining 
     * jobs in queue, and wait. If mRate is set again before we finish 
     * purging the queue, we exit the while and don't call wait () */
    while (self->mRate == 0.0
           && wombatThrottle_sendQueuedMessage (throttle)) { }

    self->mMsgsSentThisInterval = 0;
    
    if (list_size (self->mMsgQueue) == 0)     
    {     
        /* Acquire the lock before destroying the timer. */
        wlock_lock (self->mTimerLock);

        /* Destroy the timer. */
        if (self->mTimer != NULL)     
        {     
            mamaTimer_destroy (self->mTimer);     
            self->mTimer = NULL;     
        }     

        /* Release the lock. */
        wlock_unlock (self->mTimerLock);
        
    }     

    wombatThrottle_dispatchMessagesUntilQuota (throttle);

}
Esempio n. 3
0
static void MAMACALLTYPE
syncCallback (mamaTimer timer, void* closure)
{
    mamaTimer_destroy (timer);

    mamaDQPublisherManager_sendSyncRequest ((mamaDQPublisherManager) closure,50, 5, 30);
    printf ("Sent sync request.\n");
    fflush(stdout);
}
mama_status mamaStatsGenerator_stopReportTimer(mamaStatsGenerator statsGenerator)
{
    /* Returns. */
    mama_status ret = MAMA_STATUS_NULL_ARG;

    /* Get the impl. */
    mamaStatsGeneratorImpl *impl = (mamaStatsGeneratorImpl*)statsGenerator;
    if(NULL != impl)
    {
        /* Destroy the timer. */
        ret = MAMA_STATUS_OK;
        if(NULL != impl->mReportTimer)
        {
            ret = mamaTimer_destroy(impl->mReportTimer);
            impl->mReportTimer = NULL;
        }
    }

    return ret;
}