
org.kuali.common.deploy.jsp.env.jsp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kuali-deploy Show documentation
Show all versions of kuali-deploy Show documentation
Project containing deployment logic for Kuali applications
The newest version!
<%--
Copyright 2004-2013 The Kuali Foundation
Licensed under the Educational Community License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.opensource.org/licenses/ecl2.php
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--%>
<%@ page import="java.util.*,java.text.*"%>
<%
NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
nf.setMinimumFractionDigits(2);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S z");
StringBuilder sb = new StringBuilder();
Runtime runtime = Runtime.getRuntime();
int processors = runtime.availableProcessors();
double gigabyte = 1024 * 1024 * 1024;
// The total amount of memory the JVM is allowed to allocate
double maxMemory = runtime.maxMemory();
// The total amount of memory currently allocated by the JVM
double allocatedMemory = runtime.totalMemory();
// The amount of memory still available in the currently allocated heap
double freeMemory = runtime.freeMemory();
// The JDK methods supplied with the Runtime object do not directly provide
// a number for used memory. Those methods tell us what is currently allocated
// and how much of that allocation is *not* being used. The amount of memory
// currently being used by the JVM is the difference between the two.
double usedMemory = allocatedMemory - freeMemory;
// The JDK method Runtime.freeMemory() reports the amount of memory available
// in the currently allocated heap. We are interested in the total amount of
// memory still available to the JVM irrespective of the size of the currently
// allocated heap.
double totalFreeMemory = maxMemory - usedMemory;
sb.append("time: " + sdf.format(new Date()) + " \n");
sb.append("processors: " + processors + " \n");
sb.append("mem: [used=" + nf.format(usedMemory / gigabyte) + "g");
sb.append(", free=" + nf.format(totalFreeMemory / gigabyte) + "g");
sb.append(", allocated=" + nf.format(allocatedMemory / gigabyte) + "g");
sb.append(", max=" + nf.format(maxMemory / gigabyte) + "g");
sb.append("] \n");
String pathSeparatorKey = "path.separator";
String lineSeparatorKey = "line.separator";
String pathSeparator = System.getProperty(pathSeparatorKey);
Properties p = System.getProperties();
Map m = new TreeMap();
Set names = p.stringPropertyNames();
for (String name : names) {
String value = p.getProperty(name);
m.put(name, value);
}
sb.append("");
sb.append("\n");
sb.append("System Property Value \n");
for (String name : m.keySet()) {
String value = m.get(name);
if (value == null) {
value = "";
}
if (name.equals(lineSeparatorKey)) {
value = value.replace("\n", "LF");
value = value.replace("\r", "CR");
}
if (name.equals("common.loader") || name.contains("package.") || name.equalsIgnoreCase("tomcat.util.scan.DefaultJarScanner.jarsToSkip")) {
value = value.replace(",", "," + "
");
}
if (name.contains(".path") || name.contains(".dirs")) {
value = value.replace(pathSeparator, pathSeparator + "
");
}
if (value == null || value.trim().equals("")) {
value = " ";
}
sb.append(" \n");
sb.append(" " + name + " " + value + " \n");
sb.append(" \n");
}
sb.append("
\n");
sb.append(" ");
m = new TreeMap(System.getenv());
sb.append("\n");
sb.append("Environment Variable Value \n");
for (String name : m.keySet()) {
if (name.equals("LS_COLORS")) {
continue;
}
String value = m.get(name);
if (value == null) {
value = "";
}
if (name.equals("CATALINA_OPTS") || name.equals("JAVA_OPTS")) {
value = value.replace(" ", "
");
}
if (name.toLowerCase().contains("path")) {
value = value.replace(pathSeparator, pathSeparator + "
");
}
if (value == null || value.trim().equals("")) {
value = " ";
}
sb.append(" \n");
sb.append(" " + name + " " + value + " \n");
sb.append(" \n");
}
String name = "LS_COLORS";
String value = m.get(name);
if (value != null) {
sb.append(" \n");
value = value.replace(pathSeparator, pathSeparator + "
");
sb.append(" " + name + " " + value + " \n");
sb.append(" \n");
}
sb.append("
\n");
sb.append("
");
out.println(sb);
%>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy