1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.hadoop.hbase.procedure;
19
20 import java.io.IOException;
21
22 import org.apache.commons.logging.Log;
23 import org.apache.commons.logging.LogFactory;
24 import org.apache.hadoop.conf.Configuration;
25 import org.apache.hadoop.hbase.procedure.flush.RegionServerFlushTableProcedureManager;
26 import org.apache.hadoop.hbase.regionserver.RegionServerServices;
27 import org.apache.hadoop.hbase.regionserver.snapshot.RegionServerSnapshotManager;
28 import org.apache.zookeeper.KeeperException;
29
30
31
32
33
34
35
36 public class RegionServerProcedureManagerHost extends
37 ProcedureManagerHost<RegionServerProcedureManager> {
38
39 private static final Log LOG = LogFactory
40 .getLog(RegionServerProcedureManagerHost.class);
41
42 public void initialize(RegionServerServices rss) throws KeeperException {
43 for (RegionServerProcedureManager proc : procedures) {
44 LOG.debug("Procedure " + proc.getProcedureSignature() + " is initializing");
45 proc.initialize(rss);
46 LOG.debug("Procedure " + proc.getProcedureSignature() + " is initialized");
47 }
48 }
49
50 public void start() {
51 for (RegionServerProcedureManager proc : procedures) {
52 LOG.debug("Procedure " + proc.getProcedureSignature() + " is starting");
53 proc.start();
54 LOG.debug("Procedure " + proc.getProcedureSignature() + " is started");
55 }
56 }
57
58 public void stop(boolean force) {
59 for (RegionServerProcedureManager proc : procedures) {
60 try {
61 proc.stop(force);
62 } catch (IOException e) {
63 LOG.warn("Failed to close procedure " + proc.getProcedureSignature()
64 + " cleanly", e);
65 }
66 }
67 }
68
69 @Override
70 public void loadProcedures(Configuration conf) {
71 loadUserProcedures(conf, REGIONSERVER_PROCEDURE_CONF_KEY);
72
73 procedures.add(new RegionServerSnapshotManager());
74
75 procedures.add(new RegionServerFlushTableProcedureManager());
76 }
77
78 }