This method differentiates RollingFileAppender from its super class.

@since 0.9.0
541883
@Override
    protected void subAppend(LoggingEvent event) {
	super.subAppend(event);
	if (res != null && qw != null) {
	    long size = ((CountingQuietWriter) qw).getCount();
	    if (size >= maxFileSize && size >= nextRollover) {
		rollOver();
	    }
	}
    }
1289783
private void recurseAndAddFiles(GraphRewrite event, FileService fileService, WindupJavaConfigurationService javaConfigurationService, FileModel file)
    {
        if (javaConfigurationService.checkIfIgnored(event, file))
            return;

        String filePath = file.getFilePath();
        File fileReference = new File(filePath);
        Long directorySize = new Long(0);

        if (fileReference.isDirectory())
        {
            File[] subFiles = fileReference.listFiles();
            if (subFiles != null)
            {
                for (File reference : subFiles)
                {
                    FileModel subFile = fileService.createByFilePath(file, reference.getAbsolutePath());
                    recurseAndAddFiles(event, fileService, javaConfigurationService, subFile);
                    if (subFile.isDirectory())
                    {
                        directorySize = directorySize + subFile.getDirectorySize();
                    }
                    else
                    {
                        directorySize = directorySize + subFile.getSize();
                    }
                }
            }
            file.setDirectorySize(directorySize);
        }
    }
1183762
protected long getFileDescriptor() throws AsyncException {
        FieldReturn fRet = AccessController.doPrivileged(new PrivFieldCheck(channel));
        if (fRet.e != null) {
            throw fRet.e;
        }
        return fRet.val;
    }
130079
public final boolean roll(final LoggingEvent loggingEvent) {
    for (int i = 0; i < this.fileRollables.length; i++) {
      if (this.fileRollables[i].roll(loggingEvent)) {
        return true;
      }
    }
    return false;
  }
591763
@Override
    public ClassLoader getThrowawayClassLoader() {
        ClassLoader newParent = getThrowawayVersion(getParent());
        ClassLoader[] newFollowOns = new ClassLoader[followOnClassLoaders.size()];
        for (int i = 0; i < newFollowOns.length; i++) {
            newFollowOns[i] = getThrowawayVersion(followOnClassLoaders.get(i));
        }
        return new UnifiedClassLoader(newParent, newFollowOns);
    }
118190
private File rollFile(boolean showError) throws IOException {
        // If the base file exists, rename it and recreate it.
        File file = new File(directory, fileName + fileExtension);
        if (file.isFile()) {
            // Reuse the file if it's already empty.
            if (file.length() == 0) {
                return file;
            }

            if (maxFiles == 1) {
                if (!LoggingFileUtils.deleteFile(file, showError)) {
                    // We failed to delete the file and issued a message.
                    return file;
                }
            } else if (createNewUniqueFile(file, showError) == null) {
                // We failed to rename (or copy + delete) the base file to a new
                // file, and we already issued a message.
                return file;
            }
        }

        if (!file.createNewFile() && showError) {
            // Unsafe to use FFDC or ras: log to raw stderr
            String msg = Tr.formatMessage(TraceSpecification.getTc(), "UNABLE_TO_CREATE_RESOURCE_NOEX", file);
            BaseTraceService.rawSystemErr.println(msg);
        }

        return file;
    }
262276
synchronized long rollEditLog() throws IOException {
    LOG.info("Rolling edit logs.");
    long start = System.nanoTime();
    
    endCurrentLogSegment(true);
    long nextTxId = getLastWrittenTxId() + 1;
    startLogSegment(nextTxId, true);

    assert curSegmentTxId == nextTxId;
    long rollTime = DFSUtil.getElapsedTimeMicroSeconds(start);
    if (metrics != null) {
      metrics.rollEditLogTime.inc(rollTime);
      metrics.tsLastEditsRoll.set(System.currentTimeMillis());
    }
    return nextTxId;
  }
625249
@Override
    public void rollLogs() {
        summaryFile = null;

        List<IncidentImpl> incidentCopies;
        synchronized (incidents) {
            incidentCopies = new ArrayList<IncidentImpl>(incidents.values());
        }

        int overage = incidentCopies.size() - 500;
        if (overage > 0) {
            // we have more than 500 incidents: we need to remove least-recently-seen
            // incidents until we're back to 500. We do this daily to prevent unchecked growth
            // in the number of incidents we remember
            List<IncidentImpl> lastSeenIncidents = new ArrayList<IncidentImpl>(incidentCopies);

            // sort the incidents by when they were last seen, rather than when they were added
            Collections.sort(lastSeenIncidents, new Comparator<IncidentImpl>() {
                @Override
                public int compare(IncidentImpl o1, IncidentImpl o2) {
                    // static method on double does the same as Long.compareTo, and we avoid
                    // object allocation or auto-boxing, etc.
                    return Double.compare(o1.getTimeStamp(), o2.getTimeStamp());
                }
            });

            // For each item we're over 500, remove one from the front of the list (least recently seen)
            synchronized (incidents) {
                for (Iterator<IncidentImpl> i = lastSeenIncidents.iterator(); i.hasNext() && overage > 0; overage--) {
                    IncidentImpl impl = i.next();
                    i.remove();

                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "FFDC cleanup -- removing " + impl.key);
                    }
                    // remove the incident from the map, and clean it up (remove the associated files)
                    incidents.remove(impl.key);
                    impl.cleanup();
                }
            }
        }

        for (IncidentImpl incident : incidentCopies) {
            incident.roll();
        }

        logSummary(incidentCopies);
    }
755086
private void determineChangesSince(File file, long lastScanTime) {
		try {
			if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) {
				log.info("Firing file changed event " + file);
			}
			listener.fileChanged(file);
			if (file.isDirectory()) {
				File[] filesOfInterest = file.listFiles(new RecentChangeFilter(lastScanTime));
				for (File f : filesOfInterest) {
					if (f.isDirectory()) {
						determineChangesSince(f, lastScanTime);
					}
					else {
						if (GlobalConfiguration.verboseMode && log.isLoggable(Level.INFO)) {
							log.info("Observed last modification time change for " + f + "  (lastScanTime="
									+ lastScanTime + ")");
							log.info("Firing file changed event " + file);
						}
						listener.fileChanged(f);
					}
				}
			}
		}
		catch (Throwable t) {
			if (log.isLoggable(Level.SEVERE)) {
				log.log(Level.SEVERE, "FileWatcher caught serious error, see cause", t);
			}
		}
	}
1080445
def _select_file_guard(datasource_method):
        
        from functools import wraps
        @wraps(datasource_method)
        def wrapper(self, itraj):
            # itraj already selected, we're done.
            if itraj == self._selected_itraj:
                return
            datasource_method(self, itraj)
            self._itraj = self._selected_itraj = itraj
        return wrapper
515300
public void free()
    {
        Record record = null;
        if (this.getMessageSource() instanceof Record)
            record = (Record)this.getMessageSource();
        
        super.free();
        
        if (record != null)
        {
            BaseSyncRecordMessageFilterHandler fileListener = (BaseSyncRecordMessageFilterHandler)record.getListener(BaseSyncRecordMessageFilterHandler.class, false);
            if (fileListener != null)
                if (fileListener.getRecordMessageFilter() == this)
            {   // Always
                    // Note: Removing this fileListener will call free again for this object... shouldn't be a problem, since everything has been zeroed --- may want to fix this later
                record.removeListener(fileListener, true);
            }
        }
    }
1179484
public static void popPreferredClassLoader() {
		final ClassLoader sysLoader = ClassLoaderFinder.class.getClassLoader();

		if ((dynamicLoader == null) || (dynamicLoader == sysLoader)) {
			dynamicLoader = null;
			final Thread[] threads = new Thread[Thread.activeCount()];
			Thread.enumerate(threads);
			for (final Thread t : threads) {
				if (t != null) {
					t.setContextClassLoader(sysLoader);
				}
			}
			return;
		}

		final ClassLoader parent = dynamicLoader.getParent();

		dynamicLoader = (parent == sysLoader) ? null : parent;

		final Thread[] threads = new Thread[Thread.activeCount()];
		Thread.enumerate(threads);
		for (final Thread t : threads) {
			if (t != null) {
				t.setContextClassLoader(parent);
			}
		}
	}
319213
@Override
    public void stop() {
        try {
            if (randomAccessFile != null) {
                randomAccessFile.close();
                fileChannel.close();
            }
            randomAccessFile = null;
            fileChannel = null;
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
183211
private void removeOldFiles()
    {
        if (_retainDays>0)
        {
            Calendar retainDate = Calendar.getInstance();
            retainDate.add(Calendar.DATE,-_retainDays);
            int borderYear = retainDate.get(java.util.Calendar.YEAR);
            int borderMonth = retainDate.get(java.util.Calendar.MONTH) + 1;
            int borderDay = retainDate.get(java.util.Calendar.DAY_OF_MONTH);

            File file= new File(_filename);
            File dir = new File(file.getParent());
            String fn=file.getName();
            int s=fn.toLowerCase().indexOf(YYYY_MM_DD);
            if (s<0)
                return;
            String prefix=fn.substring(0,s);
            String suffix=fn.substring(s+YYYY_MM_DD.length());

            String[] logList=dir.list();
            for (int i=0;i<logList.length;i++)
            {
                fn = logList[i];
                if(fn.startsWith(prefix)&&fn.indexOf(suffix,prefix.length())>=0)
                {        
                    try
                    {
                        StringTokenizer st = new StringTokenizer (fn.substring(prefix.length(), prefix.length()+YYYY_MM_DD.length()), "_.");
                        int nYear = Integer.parseInt(st.nextToken());
                        int nMonth = Integer.parseInt(st.nextToken());
                        int nDay = Integer.parseInt(st.nextToken());
                        
                        if (nYear<borderYear ||
                            (nYear==borderYear && nMonth<borderMonth) ||
                            (nYear==borderYear &&
                             nMonth==borderMonth &&
                             nDay<=borderDay))
                        {
                            log.info("Log age "+fn);
                            new File(dir,fn).delete();
                        }
                    }
                    catch(Exception e)
                    {
                        if (log.isDebugEnabled())
                            e.printStackTrace();
                    }
                }
            }
        }
    }
464495
private void updateDefaultTimeAndSizeRollingAppender(final FoundationFileRollingAppender appender) {

		if (appender.getDatePattern().trim().length() == 0) {
			appender.setDatePattern(FoundationLoggerConstants.DEFAULT_DATE_PATTERN.toString());
		}
		
		String maxFileSizeKey = "log4j.appender."+appender.getName()+".MaxFileSize";
		appender.setMaxFileSize(FoundationLogger.log4jConfigProps.getProperty(maxFileSizeKey, FoundationLoggerConstants.Foundation_MAX_FILE_SIZE.toString()));

//		if (appender.getMaxFileSize() == null || appender.getMaxFileSize().equals(FoundationLoggerConstants.DEFAULT_FILE_SIZE.toString())) {
//			appender.setMaxFileSize(FoundationLoggerConstants.Foundation_MAX_FILE_SIZE.toString());
//		}

		String maxRollCountKey = "log4j.appender."+appender.getName()+".MaxRollFileCount";
		appender.setMaxRollFileCount(Integer.parseInt(FoundationLogger.log4jConfigProps.getProperty(maxRollCountKey,"100")));
	}
381796
protected synchronized void checkRollOver ()
    {
        // check to see if we should roll over the log
        String newDayStamp = _dayFormat.format(new Date());

        // hey! we need to roll it over!
        if (!newDayStamp.equals(_dayStamp)) {
            log("log_closed");
            _logWriter.close();
            _logWriter = null;

            // rename the old file
            String npath = _logPath.getPath() + "." + _dayStamp;
            if (!_logPath.renameTo(new File(npath))) {
                log.warning("Failed to rename audit log file", "path", _logPath, "npath", npath);
            }

            // open our new log file
            openLog(false);

            // and set the next day stamp
            _dayStamp = newDayStamp;
        }

        scheduleNextRolloverCheck();
    }
111223
@Override
    public void batchRolledBack()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "batchRolledBack");

        resetDoubtHorizon();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "batchRolledBack");

    }