/** * Converts the input time into millisecond unit. * * @param time the time to be converted into milliseconds * @return the time in millisecond unit */ public static long getMs(String time) { try { return FormatUtils.parseTimeSize(time); } catch (Exception e) { throw new RuntimeException(ExceptionMessage.INVALID_TIME.getMessage(time)); } }
/** * Starts {@link DailyMetadataBackup}. */ public void start() { Preconditions.checkState(mBackup == null); long delayedTimeInMillis = getTimeToNextBackup(); mBackup = mScheduledExecutor.scheduleAtFixedRate(this::dailyBackup, delayedTimeInMillis, FormatUtils.parseTimeSize("1day"), TimeUnit.MILLISECONDS); LOG.info("Daily metadata backup scheduled to start in {}", CommonUtils.convertMsToClockTime(delayedTimeInMillis)); }
@Override public long getMs(PropertyKey key) { String rawValue = get(key); try { return FormatUtils.parseTimeSize(rawValue); } catch (Exception e) { throw new RuntimeException(ExceptionMessage.KEY_NOT_MS.getMessage(key)); } }
@Override public void cleanup() { long cleanAge = mConf.isSet(PropertyKey.UNDERFS_S3A_INTERMEDIATE_UPLOAD_CLEAN_AGE) ? mConf.getMs(PropertyKey.UNDERFS_S3A_INTERMEDIATE_UPLOAD_CLEAN_AGE) : FormatUtils.parseTimeSize(PropertyKey.UNDERFS_S3A_INTERMEDIATE_UPLOAD_CLEAN_AGE .getDefaultValue()); Date cleanBefore = new Date(new Date().getTime() - cleanAge); mManager.abortMultipartUploads(mBucketName, cleanBefore); }
timeUnit = TimeUnit.valueOf(arg); System.out.println( FormatUtils.parseTimeSize(property.getValue()) / timeUnit.getValue()); break; } catch (IllegalArgumentException ex) {
@Override public long getMs(PropertyKey key) { String rawValue = get(key); try { return FormatUtils.parseTimeSize(rawValue); } catch (Exception e) { throw new RuntimeException(ExceptionMessage.KEY_NOT_MS.getMessage(key)); } }