devmadhuu commented on code in PR #6658:
URL: https://github.com/apache/ozone/pull/6658#discussion_r1604513736
##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/ReconUtils.java:
##########
@@ -509,4 +516,46 @@ public SCMNodeDetails
getReconNodeDetails(OzoneConfiguration conf) {
public static void setLogger(Logger logger) {
log = logger;
}
+
+ /**
+ * Return if all OMDB tables that will be used are initialized.
+ * @return if tables are initialized
+ */
+ public static boolean isInitializationComplete(ReconOMMetadataManager
omMetadataManager) {
+ if (omMetadataManager == null) {
+ return false;
+ }
+ return omMetadataManager.getVolumeTable() != null
+ && omMetadataManager.getBucketTable() != null
+ && omMetadataManager.getDirectoryTable() != null
+ && omMetadataManager.getFileTable() != null
+ && omMetadataManager.getKeyTable(BucketLayout.LEGACY) != null;
+ }
+
+ /**
+ * Converts string date in a provided format to server timezone's epoch
milllioseconds.
+ *
+ * @param dateString
+ * @param dateFormat
+ * @param timeZone
+ * @return
+ * @throws ParseException
+ */
+ public static long convertToEpochMillis(String dateString, String
dateFormat, TimeZone timeZone) {
+ try {
+ if (StringUtils.isEmpty(dateString)) {
+ return Instant.now().toEpochMilli();
+ }
+ SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
+ sdf.setTimeZone(timeZone); // Set server's timezone
+ Date date = sdf.parse(dateString);
+ return date.getTime(); // Convert to epoch milliseconds
+ } catch (ParseException parseException) {
+ log.error("Date parse exception for date: {} in format: {} -> {}",
dateString, dateFormat, parseException);
Review Comment:
ok done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]