String[] classes = conf.get(POST_DEMUX_DATA_LOADER,"org.apache.hadoop.chukwa.dataloader.MetricDataLoaderPool,org.apache.hadoop.chukwa.dataloader.FSMDataLoader").split(",");
for(String dataLoaderName : classes) {
Class<? extends DataLoaderFactory> dl = (Class<? extends DataLoaderFactory>) Class.forName(dataLoaderName);
java.lang.reflect.Constructor<? extends DataLoaderFactory> c =
dl.getConstructor();
DataLoaderFactory dataloader = c.newInstance();
//DataLoaderFactory dataLoader = (DataLoaderFactory) Class.
// forName(dataLoaderName).getConstructor().newInstance();
log.info(dataLoaderName+" processing: "+directory);
StringBuilder dirSearch = new StringBuilder();
dirSearch.append(directory);
dirSearch.append("/*/*");
log.debug("dirSearch: " + dirSearch);
Path demuxDir = new Path(dirSearch.toString());
// CHUKWA-648: Make Chukwa Reduce Type to support hierarchy format
// List all event files under the hierarchy data-type directory
PathFilter filter = new PathFilter()
{public boolean accept(Path file) {
return file.getName().endsWith(".evt");
} };
List<FileStatus> eventfiles = HierarchyDataType.globStatus(fs, demuxDir,filter,true);
FileStatus[] events = eventfiles.toArray(new FileStatus[eventfiles.size()]);
dataloader.load(conf, fs, events);
}
} catch(Exception e) {
log.error(ExceptionUtil.getStackTrace(e));
return false;
}