Example #1
0
///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::IgnoreConnectionResults
//
// Throw away results for all jobs using this connection
//
///////////////////////////////////////////////////////////////
void CDatabaseJobQueueImpl::IgnoreConnectionResults ( SConnectionHandle connectionHandle )
{
    shared.m_Mutex.Lock ();

    // All active jobhandles will either be in m_CommandQueue or m_ResultQueue or m_FinishedList
    for ( CJobQueueType::iterator iter = shared.m_CommandQueue.begin () ; iter != shared.m_CommandQueue.end () ; ++iter )
        if ( (*iter)->command.connectionHandle == connectionHandle )
            IgnoreJobResults ( *iter );

    for ( CJobQueueType::iterator iter = shared.m_ResultQueue.begin () ; iter != shared.m_ResultQueue.end () ; ++iter )
        if ( (*iter)->command.connectionHandle == connectionHandle )
            IgnoreJobResults ( *iter );

    shared.m_Mutex.Unlock ();
}
Example #2
0
///////////////////////////////////////////////////////////////
//
// CDatabaseJobQueueImpl::FreeCommand
//
// Throw away result when this job is done
// Returns false if jobHandle not correct
//
///////////////////////////////////////////////////////////////
bool CDatabaseJobQueueImpl::FreeCommand ( CDbJobData* pJobData )
{
    if ( !MapContains ( m_ActiveJobHandles, pJobData->GetId () ) )
    {
        CLogger::ErrorPrintf ( "FreeCommand: Serious problem #1 here\n" );
        return false;
    }

    if ( pJobData->result.bIgnoreResult )
        return false;       // Already ignoring query handle

    // if in command or result queue, then put in ignore result list
    bool bFound;
    shared.m_Mutex.Lock ();

    bFound = ListContains ( shared.m_CommandQueue, pJobData ) || ListContains ( shared.m_ResultQueue, pJobData );

    shared.m_Mutex.Unlock ();

    if ( !bFound )
    {
        // Must be in finished list
        if ( !MapContains ( m_FinishedList, pJobData ) )
            CLogger::ErrorPrintf ( "FreeCommand: Serious problem #2 here\n" );
        return false; 
    }

    IgnoreJobResults ( pJobData );
    return true;
}
///////////////////////////////////////////////////////////////
//
// CCompressorJobQueueImpl::FreeCommand
//
// Throw away result when this job is done
// Returns false if jobHandle not correct
//
///////////////////////////////////////////////////////////////
bool CCompressorJobQueueImpl::FreeCommand ( CCompressJobData* pJobData )
{
    if ( MapContains ( m_IgnoreResultList, pJobData ) )
        return false;       // Already ignoring query handle

    // if in command or result queue, then put in ignore result list
    bool bFound;
    shared.m_Mutex.Lock ();

    bFound = ListContains ( shared.m_CommandQueue, pJobData ) || ListContains ( shared.m_ResultQueue, pJobData );

    shared.m_Mutex.Unlock ();

    if ( !bFound )
    {
        // Must be in finished list
        if ( !MapContains ( m_FinishedList, pJobData ) )
            OutputDebugLine ( "FreeCommand: Serious problem #2 here\n" );
        return false; 
    }

    IgnoreJobResults ( pJobData );
    return true;
}