1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver.compactions;
20
21 import java.util.ArrayList;
22 import java.util.List;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.hadoop.classification.InterfaceAudience;
27 import org.apache.hadoop.hbase.regionserver.StoreFile;
28 import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
29
30 @InterfaceAudience.Private
31 public class CompactSelection {
32 private static final long serialVersionUID = 1L;
33 static final Log LOG = LogFactory.getLog(CompactSelection.class);
34
35 List<StoreFile> filesToCompact = new ArrayList<StoreFile>();
36
37 boolean isOffPeakCompaction = false;
38
39 private final long selectionTime;
40
41 public CompactSelection(List<StoreFile> filesToCompact) {
42 this.selectionTime = EnvironmentEdgeManager.currentTimeMillis();
43 this.filesToCompact = filesToCompact;
44 this.isOffPeakCompaction = false;
45 }
46
47 public List<StoreFile> getFilesToCompact() {
48 return filesToCompact;
49 }
50
51
52
53
54
55 public void emptyFileList() {
56 filesToCompact.clear();
57 }
58
59 public boolean isOffPeakCompaction() {
60 return this.isOffPeakCompaction;
61 }
62
63 public void setOffPeak(boolean value) {
64 this.isOffPeakCompaction = value;
65 }
66
67 public long getSelectionTime() {
68 return selectionTime;
69 }
70
71 public CompactSelection getSubList(int start, int end) {
72 filesToCompact = filesToCompact.subList(start, end);
73 return this;
74 }
75
76 public void clearSubList(int start, int end) {
77 filesToCompact.subList(start, end).clear();
78 }
79 }