You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ch...@apache.org on 2017/05/12 07:08:10 UTC
svn commit: r1794935 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java
Author: chetanm
Date: Fri May 12 07:08:10 2017
New Revision: 1794935
URL: http://svn.apache.org/viewvc?rev=1794935&view=rev
Log:
OAK-6080 - Index report service
-- Included the last updated time
-- Format time as per ISO8601
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java?rev=1794935&r1=1794934&r2=1794935&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/inventory/IndexPrinter.java Fri May 12 07:08:10 2017
@@ -20,6 +20,7 @@
package org.apache.jackrabbit.oak.plugins.index.inventory;
import java.io.PrintWriter;
+import java.util.Calendar;
import java.util.List;
import com.google.common.base.Strings;
@@ -39,6 +40,7 @@ import org.apache.jackrabbit.oak.plugins
import org.apache.jackrabbit.oak.plugins.index.AsyncIndexInfoService;
import org.apache.jackrabbit.oak.plugins.index.IndexInfo;
import org.apache.jackrabbit.oak.plugins.index.IndexInfoService;
+import org.apache.jackrabbit.util.ISO8601;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -82,7 +84,7 @@ public class IndexPrinter implements Inv
pw.println(lane);
AsyncIndexInfo info = asyncIndexInfoService.getInfo(lane);
if (info != null) {
- pw.printf(" Last Indexed To : %tc%n", info.getLastIndexedTo());
+ pw.printf(" Last Indexed To : %s%n", formatTime(info.getLastIndexedTo()));
IndexStatsMBean stats = info.getStatsMBean();
if (stats != null) {
pw.printf(" Status : %s%n", stats.getStatus());
@@ -130,7 +132,11 @@ public class IndexPrinter implements Inv
}
if (info.getIndexedUpToTime() > 0){
- pw.printf(" Last Indexed Upto : %tc%n", info.getIndexedUpToTime());
+ pw.printf(" Last Indexed Upto : %s%n", formatTime(info.getIndexedUpToTime()));
+ }
+
+ if (info.getLastUpdatedTime() > 0){
+ pw.printf(" Last updated time : %s%n", formatTime(info.getLastUpdatedTime()));
}
if (info.getSizeInBytes() >= 0){
@@ -142,4 +148,10 @@ public class IndexPrinter implements Inv
}
pw.println();
}
+
+ private static String formatTime(long time){
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeInMillis(time);
+ return ISO8601.format(cal);
+ }
}