protected void initializeCounterIfNecessary() {
if (!initialized) {
FsShell fsShell = new FsShell(getFileSystem().getConf(), getFileSystem());
try {
if (!fsShell.test(getBasePath())) {
fsShell.mkdir(getBasePath());
}
int maxCounter = 0;
boolean foundFile = false;
Collection<FileStatus> fileStats = fsShell.ls(this.getBasePath());
for (FileStatus fileStatus : fileStats) {