コード例 #1
0
ファイル: AbstractRestore.java プロジェクト: c3-e/opscenter
 /** Download to specific location */
 public void download(final AbstractBackupPath path, final File restoreLocation) throws Exception {
   if (config.getRestoreKeySpaces().size() != 0
       && (!config.getRestoreKeySpaces().contains(path.keyspace)
           || path.keyspace.equals(SYSTEM_KEYSPACE))) return;
   count.incrementAndGet();
   executor.submit(
       new RetryableCallable<Integer>() {
         @Override
         public Integer retriableCall() throws Exception {
           logger.info("Downloading file: " + path + " to: " + restoreLocation);
           fs.download(
               path, new FileOutputStream(restoreLocation), restoreLocation.getAbsolutePath());
           tracker.adjustAndAdd(path);
           // TODO: fix me -> if there is exception the why hang?
           if (config.isValidateBackupEnabled()) {
             logger.info("Validating : " + restoreLocation);
             String original = path.getChecksum();
             String calculated = SystemUtils.md5(restoreLocation);
             if (!original.equals(calculated)) {
               Exception e = new BackupRestoreException("Checksum mismatched.");
               logger.error(
                   original
                       + " != "
                       + calculated
                       + ". Checksum doesn't match for file "
                       + restoreLocation,
                   e);
             }
           }
           return count.decrementAndGet();
         }
       });
 }
コード例 #2
0
ファイル: AbstractRestore.java プロジェクト: c3-e/opscenter
 public AbstractRestore(
     IConfiguration config, IBackupFileSystem fs, String name, Sleeper sleeper) {
   super(config);
   this.config = config;
   this.fs = fs;
   this.sleeper = sleeper;
   executor = new NamedThreadPoolExecutor(config.getMaxBackupDownloadThreads(), name);
   executor.allowCoreThreadTimeOut(true);
 }