public V3Serializer(LockssDaemon daemon) throws PollSerializerException { this.daemon = daemon; Configuration config = CurrentConfig.getCurrentConfig(); File stateDir = PollUtil.ensurePollStateRoot(); if (!FileUtil.ensureDirExists(stateDir)) { throw new PollSerializerException("Could not create state directory " + stateDir); } try { this.pollDir = FileUtil.createTempDir("pollstate-", "", stateDir); } catch (IOException ex) { throw new PollSerializerException("Cannot create temp dir in state directory" + stateDir, ex); } }
/** Clean up all resources used by this poll. Removes the poll directory. */ public void closePoll() { if (pollDir != null && pollDir.isDirectory() && !FileUtil.delTree(pollDir)) log.warning("Unable to delete poll state directory: " + pollDir); }
/** * This is called when a node is in an inconsistent state. It simply creates some necessary * directories and deactivates the node. Future polls should restore it properly. * * @param node the inconsistent node */ void deactivateInconsistentNode(RepositoryNodeImpl node) { logger.warning("Deactivating inconsistent node."); FileUtil.ensureDirExists(node.contentDir); // manually deactivate node.deactivateContent(); }