The method is called getMaxMemory() and returns -1 for jdk1.3 or less. Why -1? I had to pick a number. Feel free to change.
I do not have a patch yet for StatusManagerServlet. With luck, I'll have a patch for that(with additional functionality) in the near future.
-Tim
Bill Barker wrote:
Any ideas of alternatives ?
I've just look at the jdk souce code and this method is native :-(, so I don't see an easy way to port it....Maybe you can use reflection and return |Long.MAX_VALUE| <http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Long.html#MAX_VALUE> if jdk < 1.4?
It would be much easier to just add a getRuntimeMaxMemory method to o.a.t.u.compat.JdkCompat. That's what it's there for.
Index: JdkCompat.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/JdkCompat.java,v
retrieving revision 1.3
diff -u -r1.3 JdkCompat.java
--- JdkCompat.java 5 Feb 2003 03:47:12 -0000 1.3
+++ JdkCompat.java 24 Mar 2003 20:57:57 -0000
@@ -192,5 +192,16 @@
return realFile.toURL();
}
+
+ /**
+ * Wrapper around Runtime.getRuntime().maxMemory().
+ * But this method does not exist it 1.3 or less so
+ * just return -1.
+ *
+ * @return -1
+ */
+ public long getMaxMemory() {
+ return -1;
+ }
}
Index: Jdk14Compat.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/compat/Jdk14Compat.java,v
retrieving revision 1.2
diff -u -r1.2 Jdk14Compat.java
--- Jdk14Compat.java 4 Feb 2003 07:16:47 -0000 1.2
+++ Jdk14Compat.java 24 Mar 2003 20:57:58 -0000
@@ -114,4 +114,14 @@
}
+ /**
+ * Wrapper around Runtime.getRuntime().maxMemory()
+ *
+ * @return see Runtime.getRuntime().maxMemory()
+ */
+ public long getMaxMemory() {
+ return Runtime.getRuntime().maxMemory();
+ }
+
+
}--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
