Skip to content

The Unified and Autonomous Development Platform

Fix a performance issue by reusing PrettyTime instance

robin shenaddc3fab2a8d
diff --git a/web/src/main/java/com/gitplex/server/web/page/admin/ServerInformationPage.java b/web/src/main/java/com/gitplex/server/web/page/admin/ServerInformationPage.java
index b0008b2e3d..7f98cbf2b2 100644
--- a/web/src/main/java/com/gitplex/server/web/page/admin/ServerInformationPage.java
+++ b/web/src/main/java/com/gitplex/server/web/page/admin/ServerInformationPage.java
@@ -10,6 +10,7 @@ import com.gitplex.server.util.FileUtils;
import com.gitplex.server.web.util.DateUtils;
import de.agilecoders.wicket.core.markup.html.bootstrap.components.progress.ProgressBar;
+import de.agilecoders.wicket.core.markup.html.bootstrap.components.progress.ProgressBar.Type;
@SuppressWarnings("serial")
public class ServerInformationPage extends AdministrationPage {
@@ -50,7 +51,7 @@ public class ServerInformationPage extends AdministrationPage {
/ Runtime.getRuntime().maxMemory() * 100);
}
- }, true));
+ }, Type.SUCCESS, true));
add(new Label("osUserName", System.getProperty("user.name")));
diff --git a/web/src/main/java/com/gitplex/server/web/util/DateUtils.java b/web/src/main/java/com/gitplex/server/web/util/DateUtils.java
index 961305a7c4..bcd4028353 100644
--- a/web/src/main/java/com/gitplex/server/web/util/DateUtils.java
+++ b/web/src/main/java/com/gitplex/server/web/util/DateUtils.java
@@ -9,8 +9,10 @@ import com.gitplex.server.web.WebConstants;
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
+ private static final PrettyTime PRETTY_TIME = new PrettyTime();
+
public static String formatAge(Date date) {
- return new PrettyTime().format(date);
+ return PRETTY_TIME.format(date);
}
public static String formatDate(Date date) {