code: private void checkSpaceConstrain(long logFileSize) {
  		long spaceNeeded;
  		if (maxRepositorySize > 0) {
  			synchronized(fileList) {
  				initFileList(false);
  				long purgeSize = totalSize + logFileSize - maxRepositorySize;
  				if (debugLogger.isLoggable(Level.FINE) && LogRepositoryBaseImpl.isDebugEnabled()) {
  					debugLogger.logp(Level.FINE, thisClass, "checkSpaceConstrain", "total: "+totalSize+
  					" maxLog: "+logFileSize+" maxRepos: "+maxRepositorySize) ;
  				}
  				if (purgeSize > 0) {
  					purgeOldFiles(purgeSize);
  				}
  				spaceNeeded = maxRepositorySize - totalSize;
  			}
  		} else {
  			spaceNeeded = MAX_LOG_FILE_SIZE; // If no limit ensure that at least one log file can be written
  		}
  		LogRepositorySpaceAlert.getInstance().setRepositoryInfo(this, repositoryLocation, spaceNeeded) ;
  	}
docs: /*
  Make sure that repository has enough space for a new file