예제 #1
0
bool GroupPool::AddJobToPrivilegeQueue(const JobPtr& job, bool push_front) {
    WriteLocker locker(m_privilege_job_queue_lock);
    // TODO test
    if (!FindByName(job->GetGroupName())) {
        LOG4CPLUS_ERROR(logger, "No this group, group name: " << job->GetGroupName()); 
        return false;
    }

    printf("privilege!\n");
    if (push_front)
        m_privilege_wait_job_queue.push_front(job);
    else
        m_privilege_wait_job_queue.push_back(job);
    return true;
}
예제 #2
0
// add job to wait queue
bool GroupPool::AddJobToWaitQueue(const JobPtr& job) {
    int priority = job->GetRawPriority();
    if (JOB_RAW_PRIO_PRIVILEGE == priority) {
        if (!AddJobToPrivilegeQueue(job)) {
            LOG4CPLUS_ERROR(logger, "Failed to AddJobToPrivilegeQueue.");
            return false;
        }
    } else {
        if (!AddJobToWaitQueueByGroup(job)) {
            // test
            printf("No this group, %s\n", job->GetGroupName().c_str());
            LOG4CPLUS_ERROR(logger, "No this group, group name: " << job->GetGroupName()); 
            return false; 
        }         
    }
    return true;
}
예제 #3
0
bool GroupPool::AddJobToWaitQueueByGroup(const JobPtr& job) {
    string group_name = job->GetGroupName();
    GroupPtr group_ptr = GetGroupPtr(group_name);
    if (NULL == group_ptr) {
        return false;
    }
    
    // group_ptr->AddJobToWaitQueueAutoLock(job);
    group_ptr->AddJobToWaitQueue(job);
    return true;
}