コード例 #1
0
 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);
   }
 }
コード例 #2
0
 /** 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);
 }
コード例 #3
0
 /**
  * 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();
 }