0.9.8.10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
home
doug
src
hypertable
src
cc
Hypertable
RangeServer
MaintenanceTaskWorkQueue.cc
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2007-2015 Hypertable, Inc.
3
*
4
* This file is part of Hypertable.
5
*
6
* Hypertable is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; version 3 of the
9
* License, or any later version.
10
*
11
* Hypertable is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19
* 02110-1301, USA.
20
*/
21
22
#include <
Common/Compat.h
>
23
24
#include "
Global.h
"
25
#include "
MaintenanceTaskWorkQueue.h
"
26
27
using namespace
Hypertable
;
28
using namespace
std
;
29
30
MaintenanceTaskWorkQueue::MaintenanceTaskWorkQueue
(uint32_t level,
int
priority,
31
std::vector<MetaLog::EntityTaskPtr> &work)
32
:
MaintenanceTask
(level, priority,
String
(
"WORK QUEUE"
)) {
33
m_work
.swap(work);
34
}
35
36
37
MaintenanceTaskWorkQueue::~MaintenanceTaskWorkQueue
() {
38
if
(!
m_completed
.empty())
39
Global::rsml_writer
->record_removal(
m_completed
);
40
}
41
42
43
void
MaintenanceTaskWorkQueue::execute
() {
44
for
(
auto
&entity_task :
m_work
) {
45
try
{
46
if
(!entity_task->execute()) {
47
lock_guard<mutex> lock(
Global::mutex
);
48
Global::work_queue
.push_back(entity_task);
49
}
50
else
51
m_completed
.push_back(entity_task);
52
}
53
catch
(
Hypertable::Exception
&e) {
54
HT_ERROR_OUT
<< e <<
HT_END
;
55
lock_guard<mutex> lock(
Global::mutex
);
56
Global::work_queue
.push_back(entity_task);
57
}
58
catch
(std::exception &e) {
59
HT_ERROR_OUT
<<
"Problem executing "
<< entity_task->name() <<
" - "
<< e.what() <<
HT_END
;
60
lock_guard<mutex> lock(
Global::mutex
);
61
Global::work_queue
.push_back(entity_task);
62
}
63
}
64
}
Hypertable::MaintenanceTaskWorkQueue::m_work
std::vector< MetaLog::EntityTaskPtr > m_work
Definition:
MaintenanceTaskWorkQueue.h:37
Global.h
Hypertable::String
std::string String
A String is simply a typedef to std::string.
Definition:
String.h:44
MaintenanceTaskWorkQueue.h
std
STL namespace.
Hypertable::Global::work_queue
static std::vector< MetaLog::EntityTaskPtr > work_queue
Definition:
Global.h:114
Hypertable::Global::rsml_writer
static MetaLog::WriterPtr rsml_writer
Definition:
Global.h:81
Compat.h
Compatibility Macros for C/C++.
Hypertable::MaintenanceTask
Definition:
MaintenanceTask.h:34
HT_END
#define HT_END
Definition:
Logger.h:220
HT_ERROR_OUT
#define HT_ERROR_OUT
Definition:
Logger.h:301
Hypertable::MaintenanceTaskWorkQueue::MaintenanceTaskWorkQueue
MaintenanceTaskWorkQueue(uint32_t level, int priority, std::vector< MetaLog::EntityTaskPtr > &work)
Definition:
MaintenanceTaskWorkQueue.cc:30
Hypertable
Hypertable definitions
Definition:
ApplicationHandler.h:36
Hypertable::MaintenanceTaskWorkQueue::m_completed
std::vector< MetaLog::EntityPtr > m_completed
Definition:
MaintenanceTaskWorkQueue.h:38
Hypertable::Exception
This is a generic exception class for Hypertable.
Definition:
Error.h:314
Hypertable::Global::mutex
static std::mutex mutex
Definition:
Global.h:62
Hypertable::MaintenanceTaskWorkQueue::execute
virtual void execute()
Definition:
MaintenanceTaskWorkQueue.cc:43
Hypertable::MaintenanceTaskWorkQueue::~MaintenanceTaskWorkQueue
virtual ~MaintenanceTaskWorkQueue()
Definition:
MaintenanceTaskWorkQueue.cc:37
Generated on Tue Dec 22 2015 18:43:16 for Hypertable by
1.8.8