base
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
/***************************************************************************
|
||||
Process 상태 정보 저장 및 console 출력 처리 class
|
||||
-----------------------------------------
|
||||
begin : 2010/03/05
|
||||
copyright : (C) 2005 Solbox Inc.
|
||||
author : storage dev team
|
||||
email : storage.sd@solbox.com
|
||||
version : 3.3
|
||||
|
||||
CopyRight(C) 2005 Solbox Inc. All Rights reserved.
|
||||
Redistribution and use in source and binary forms, with or with out
|
||||
modification, are not permitted in outside of Solbox Inc.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __PROCESS_STATUS_H__
|
||||
#define __PROCESS_STATUS_H__
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include "DataQueue.hpp"
|
||||
#include "ReplicationData.h"
|
||||
#include "CacheRequestData.h"
|
||||
#include "CacheJobList.h"
|
||||
|
||||
// CProcessStatus class
|
||||
// - 프로세스 내부에서 사용 중인 Queue 정보와
|
||||
// - Replcation 처리 thread 수, Hot Content 처리 thread 수를 관리,
|
||||
// - 해당 정보를 console 상에 표시하는 역활을 수행한다.
|
||||
// - 2016-06-18 다른 모듈과 연동시 반환값 처리 관련 문제가 많아
|
||||
// 확장성 포기하고 업무 Flow 에 맞게 단순하게 동작하도록 수정 처리함.
|
||||
// 특히 무제한 설정 관련 기능은 전부 제거 처리함.
|
||||
class CProcessStatus
|
||||
{
|
||||
private:
|
||||
|
||||
// Replication 처리 관련 동시 최대 생성 가능 Thread 수.
|
||||
int m_nMaxReplicationThreadCount;
|
||||
|
||||
// Hot Content cache 처리 관련 동시 최대 생성 가능 Thread 수
|
||||
int m_nMaxCacheThreadCount;
|
||||
|
||||
// Lock 처리 관련
|
||||
pthread_mutex_t m_mxReplicateThreadCount;
|
||||
pthread_mutex_t m_mxCacheThreadCount;
|
||||
|
||||
|
||||
////// 프로세스 title 로 모니터 대상 정보 /////////////
|
||||
|
||||
// Replication 처리 관련 현재 생성된 Thread 수.
|
||||
int m_nCurrentReplicationCount;
|
||||
|
||||
// Hot Content cache 처리 관련 현재 생성된 Thread 수
|
||||
int m_nCurrentCacheCount;
|
||||
|
||||
// Replication content 저장 queue 에 대한 포인터
|
||||
// 생성자를 통해 전달받음.
|
||||
CDataQueue<CSourceData>* m_pQueueSource;
|
||||
|
||||
// Replication 재시도 content 저장 queue 에 대한 포인터
|
||||
// 생성자를 통해 전달받음.
|
||||
CDataQueue<CRetryData>* m_pQueueRetry;
|
||||
|
||||
// Replication 완료 정보 저장 queue 에 대한 포인터
|
||||
// 생성자를 통해 전달받음.
|
||||
CDataQueue<CCompleteData>* m_pQueueCompleteReplication;
|
||||
|
||||
// Hot Content cache 요청 정보 저장 관련 queue 에 대한 포인터.
|
||||
CDataQueue<CCacheRequestData>* m_pQueueCacheRequest;
|
||||
|
||||
// Hot Content cache 처리 완료 관련 queue 에 대한 포인터.
|
||||
CDataQueue<CCacheData>* m_pQueueCacheComplete;
|
||||
|
||||
// Hot Content cache 생성 관리 job 객체에 대한 포인터.
|
||||
CCacheJobList* m_pCacheJob;
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
// 작업의 종류를 구분하는 열거형 변수
|
||||
// Replication : 0, Cache : 1
|
||||
enum Job { Replication, Cache };
|
||||
|
||||
|
||||
// 쓰레드 핸들
|
||||
pthread_t m_threadHandle;
|
||||
|
||||
|
||||
public :
|
||||
// 생성자
|
||||
// @param [in] pQueueSource : Replication content 저장 queue 에 대한 포인터
|
||||
// @param [in] pQueueRetry : Replication 재시도 content 저장 queue 에 대한 포인터
|
||||
// @param [in] pQueueCompleteReplication : Replication 완료 정보 저장 queue 에 대한 포인터
|
||||
// @param [in] pQueueContentInfo : 캐시 요청 정보 저장 관련 queue 에 대한 포인터.
|
||||
// @param [in] pQueueCompleteCache : 캐시 처리 완료된 queue 에 대한 포인터.
|
||||
// @param [in] pListJob : 캐시 생성 job 객체에 대한 포인터.
|
||||
CProcessStatus( CDataQueue<CSourceData>* const pQueueSource
|
||||
, CDataQueue<CRetryData>* const pQueueRetry
|
||||
, CDataQueue<CCompleteData>* const pQueueCompleteReplication
|
||||
, CDataQueue<CCacheRequestData>* const pQueueCacheRequest
|
||||
, CDataQueue<CCacheData>* const pQueueCacheComplete
|
||||
, CCacheJobList* const pCacheJob
|
||||
);
|
||||
|
||||
// 소멸자
|
||||
~CProcessStatus();
|
||||
|
||||
// 객체 초기화
|
||||
// @param [in] nMaxReplicationThreadCount Replication 처리 관련 동시 최대 생성 가능 Thread 수
|
||||
// @param [in] nMaxCacheThreadCount Hot Content cache 처리 관련 동시 최대 생성 가능 Thread 수
|
||||
// @return true 성공
|
||||
// false 생성자로 전달된 객체 포인터가 유효하지 않은 경우,
|
||||
// 인자로 전달된 최대 Thread 수가 너무 큰 경우.(MAX_THREAD_COUNT_LIMIT 초과시)
|
||||
bool Init(const unsigned int nMaxReplicationThreadCount, const unsigned int nMaxCacheThreadCount);
|
||||
|
||||
// thread를 생성하여 프로세스 출력 상태 갱신 작업을 수행.
|
||||
bool Start();
|
||||
|
||||
|
||||
// 현재 프로세스 표시 정보 업데이트
|
||||
void UpdateTitle( void );
|
||||
|
||||
// Replication 관련 동시 생성 가능한 Thread 수를 반환
|
||||
unsigned int GetValidReplicationCount( void );
|
||||
|
||||
// Hot Content Cache 관련 동시 생성 가능한 Thread 수를 반환
|
||||
unsigned int GetValidCacheCount( void );
|
||||
|
||||
|
||||
// Replication 관련 작업 Thread 수를 1 증가 처리
|
||||
void AddReplicationCount(void);
|
||||
|
||||
// Replication 관련 작업 Thread 수를 1 감소 처리
|
||||
void SubtractReplicationCount(void);
|
||||
|
||||
|
||||
// Hot content cache 관련 작업 Thread 수를 1 증가 처리
|
||||
void AddCacheCount(void);
|
||||
|
||||
// Hot content cache 관련 작업 Thread 수를 1 감소 처리
|
||||
void SubtractCacheCount(void);
|
||||
|
||||
|
||||
private :
|
||||
|
||||
// 스레드 함수
|
||||
static void* threadFunc( void* arg );
|
||||
|
||||
|
||||
// 전달받은 작업의 Thread 수를 1 증가 시킨다.
|
||||
void AddCount(CProcessStatus::Job job);
|
||||
|
||||
// 전달받은 작업의 Thread 수를 1 감소 시킨다.
|
||||
void SubtractCount(CProcessStatus::Job job);
|
||||
|
||||
};
|
||||
|
||||
#endif //__PROCESS_STATUS_H__
|
||||
Reference in New Issue
Block a user