All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.fedora.server.journal.readerwriter.multifile.MultiFileFollowingJournalReader Maven / Gradle / Ivy

Go to download

The Fedora Client is a Java Library that allows API access to a Fedora Repository. The client is typically one part of a full Fedora installation.

The newest version!
/*
 * -----------------------------------------------------------------------------
 *
 * 

License and Copyright: The contents of this file are subject to the * Apache License, Version 2.0 (the "License"); you may not use * this file except in compliance with the License. You may obtain a copy of * the License at * http://www.fedora-commons.org/licenses.

* *

Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * the specific language governing rights and limitations under the License.

* *

The entire file consists of original code.

*

Copyright © 2008 Fedora Commons, Inc.
*

Copyright © 2002-2007 The Rector and Visitors of the University of * Virginia and Cornell University
* All rights reserved.

* * ----------------------------------------------------------------------------- */ package fedora.server.journal.readerwriter.multifile; import java.util.Map; import fedora.server.journal.JournalException; import fedora.server.journal.ServerInterface; import fedora.server.journal.recoverylog.JournalRecoveryLog; /** *

* Title: MultiFileFollowingJournalReader.java *

*

* Description: A JournalReader implementation for "following" a leading * server, when the leading server is using a {@link MultiFileJournalWriter}, * or the equivalent. The recovery is never complete, as the reader continues to * poll for recently-created files, until the server shuts down. *

*

* This class should likely be superceded by * {@link LockingFollowingJournalReader}. *

* * @author [email protected] * @version $Id: MultiFileFollowingJournalReader.java 6765 2008-03-09 20:24:44 * +0000 (Sun, 09 Mar 2008) j2blake $ * @deprecated Use {@link LockingFollowingJournalReader} instead. */ @Deprecated public class MultiFileFollowingJournalReader extends MultiFileJournalReader { private final long pollingIntervalMillis; /** * Do the super-class constructor, and then find the polling interval. */ public MultiFileFollowingJournalReader(Map parameters, String role, JournalRecoveryLog recoveryLog, ServerInterface server) throws JournalException { super(parameters, role, recoveryLog, server); pollingIntervalMillis = MultiFileJournalHelper .parseParametersForPollingInterval(parameters); } /** * Ask for a new file, using the superclass method, but if none is found, * wait for a while and ask again. This will continue until we get a server * shutdown signal. */ @Override protected synchronized JournalInputFile openNextFile() throws JournalException { while (open) { JournalInputFile nextFile = super.openNextFile(); if (nextFile != null) { return nextFile; } try { wait(pollingIntervalMillis); } catch (InterruptedException e) { // no special action on interrupt. } } return null; } /** * If the server requests a shutdown, stop waiting the next file to come in. */ @Override public synchronized void shutdown() throws JournalException { super.shutdown(); notifyAll(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy