@Override
    protected synchronized JournalInputFile openNextFile()
            throws JournalException {
        while (open) {
            boolean locked = processLockingMechanism();

            if (pauseBeforePolling) {
                try {
                    wait(pollingIntervalMillis);
                } catch (InterruptedException e) {
                    // no special action on interrupt.
                }
            }

            if (!locked) {
                JournalInputFile nextFile = super.openNextFile();
                if (nextFile != null) {
                    return nextFile;
                }
            }

            try {
                wait(pollingIntervalMillis);
            } catch (InterruptedException e) {
                // no special action on interrupt.
            }
        }
        return null;
    }
@ Override protected synchronized JournalInputFile openNextFile ( ) throws JournalException { while ( open ) { boolean locked = processLockingMechanism ( ) ; if ( pauseBeforePolling ) { try { wait ( pollingIntervalMillis ) ; } catch ( InterruptedException e ) { } } if ( ! locked ) { JournalInputFile nextFile = super . openNextFile ( ) ; if ( nextFile != null ) { return nextFile ; } } try { wait ( pollingIntervalMillis ) ; } catch ( InterruptedException e ) { } } return null ; }
Process the locking mechanism. If we are not locked, we should look for
another journal file to process. Ask for a new file, using the superclass
method, but if none is found, wait for a while and repeat. This will
continue until we get a server shutdown signal.