org.apache.hadoop.hbase.master.cleaner
Class CleanerChore<T extends FileCleanerDelegate>

java.lang.Object
  extended by org.apache.hadoop.hbase.util.HasThread
      extended by org.apache.hadoop.hbase.Chore
          extended by org.apache.hadoop.hbase.master.cleaner.CleanerChore<T>
Type Parameters:
T - Cleaner delegate class that is dynamically loaded from configuration
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
HFileCleaner, LogCleaner

public abstract class CleanerChore<T extends FileCleanerDelegate>
extends Chore

Abstract Cleaner that uses a chain of delegates to clean a directory of files


Field Summary
protected  List<T> cleanersChain
           
 
Fields inherited from class org.apache.hadoop.hbase.Chore
stopper
 
Constructor Summary
CleanerChore(String name, int sleepPeriod, Stoppable s, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path oldFileDir, String confKey)
           
 
Method Summary
protected  void chore()
          Look for chores.
 void cleanup()
          Called when the chore has completed, allowing subclasses to cleanup any extra overhead
protected abstract  boolean validate(org.apache.hadoop.fs.Path file)
          Validate the file to see if it even belongs in the directory.
 
Methods inherited from class org.apache.hadoop.hbase.Chore
choreForTesting, initialChore, run, sleep, triggerNow
 
Methods inherited from class org.apache.hadoop.hbase.util.HasThread
getName, getThread, interrupt, isAlive, isInterrupted, join, join, join, setDaemon, setName, setPriority, setUncaughtExceptionHandler, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cleanersChain

protected List<T extends FileCleanerDelegate> cleanersChain
Constructor Detail

CleanerChore

public CleanerChore(String name,
                    int sleepPeriod,
                    Stoppable s,
                    org.apache.hadoop.conf.Configuration conf,
                    org.apache.hadoop.fs.FileSystem fs,
                    org.apache.hadoop.fs.Path oldFileDir,
                    String confKey)
Parameters:
name - name of the chore being run
sleepPeriod - the period of time to sleep between each run
s - the stopper
conf - configuration to use
fs - handle to the FS
oldFileDir - the path to the archived files
confKey - configuration key for the classes to instantiate
Method Detail

validate

protected abstract boolean validate(org.apache.hadoop.fs.Path file)
Validate the file to see if it even belongs in the directory. If it is valid, then the file will go through the cleaner delegates, but otherwise the file is just deleted.

Parameters:
file - full Path of the file to be checked
Returns:
true if the file is valid, false otherwise

chore

protected void chore()
Description copied from class: Chore
Look for chores. If any found, do them else just return.

Specified by:
chore in class Chore

cleanup

public void cleanup()
Description copied from class: Chore
Called when the chore has completed, allowing subclasses to cleanup any extra overhead

Overrides:
cleanup in class Chore


Copyright © 2015 The Apache Software Foundation. All rights reserved.