*/
private AtomicInteger jspReloadCount = new AtomicInteger(0);
+ /*
+ * Counts how many times JSPs have been unloaded in this webapp.
+ */
+ private AtomicInteger jspUnloadCount = new AtomicInteger(0);
+
/**
* Preload classes required at runtime by a JSP servlet so that
* we don't get a defineClassInPackage security exception.
if (options.getMaxLoadedJsps() > 0) {
jspQueue = new FastRemovalDequeue<JspServletWrapper>(options.getMaxLoadedJsps());
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.message.jsp_queue_created",
+ "" + options.getMaxLoadedJsps(), context.getContextPath()));
+ }
}
/* Init parameter is in seconds, locally we use milliseconds */
* @return an unloadHandle that can be pushed to front of queue at later execution times.
* */
public FastRemovalDequeue<JspServletWrapper>.Entry push(JspServletWrapper jsw) {
+ if (log.isTraceEnabled()) {
+ log.trace(Localizer.getMessage("jsp.message.jsp_added",
+ jsw.getJspUri(), context.getContextPath()));
+ }
FastRemovalDequeue<JspServletWrapper>.Entry entry = jspQueue.push(jsw);
JspServletWrapper replaced = entry.getReplaced();
if (replaced != null) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.message.jsp_removed_excess",
+ jsw.getJspUri(), context.getContextPath()));
+ }
unloadJspServletWrapper(replaced);
}
return entry;
* @param unloadHandle the unloadHandle for the jsp.
* */
public void makeYoungest(FastRemovalDequeue<JspServletWrapper>.Entry unloadHandle) {
+ if (log.isTraceEnabled()) {
+ JspServletWrapper jsw = unloadHandle.getContent();
+ log.trace(Localizer.getMessage("jsp.message.jsp_queue_update",
+ jsw.getJspUri(), context.getContextPath()));
+ }
jspQueue.moveFirst(unloadHandle);
}
return jspReloadCount.intValue();
}
+ /**
+ * Gets the number of JSPs that are in the JSP limiter queue
+ *
+ * @return The number of JSPs (in the webapp with which this JspServlet is
+ * associated) that are in the JSP limiter queue
+ */
+ public int getJspQueueLength() {
+ if (jspQueue != null) {
+ return jspQueue.getSize();
+ }
+ return -1;
+ }
+
+ /**
+ * Increments the JSP unload counter.
+ */
+ public void incrementJspUnloadCount() {
+ jspUnloadCount.incrementAndGet();
+ }
+
+ /**
+ * Gets the number of JSPs that have been unloaded.
+ *
+ * @return The number of JSPs (in the webapp with which this JspServlet is
+ * associated) that have been unloaded
+ */
+ public int getJspUnloadCount() {
+ return jspUnloadCount.intValue();
+ }
+
/**
* Method used by background thread to check the JSP dependencies
synchronized(jsw) {
jsw.destroy();
}
+ jspUnloadCount.incrementAndGet();
}
*/
public void checkUnload() {
+ if (log.isTraceEnabled()) {
+ int queueLength = -1;
+ if (jspQueue != null) {
+ queueLength = jspQueue.getSize();
+ }
+ log.trace(Localizer.getMessage("jsp.message.jsp_unload_check",
+ context.getContextPath(), "" + jsps.size(), "" + queueLength));
+ }
long now = System.currentTimeMillis();
if (jspIdleTimeout > 0) {
long unloadBefore = now - jspIdleTimeout;
JspServletWrapper jsw = (JspServletWrapper)wrappers[i];
synchronized(jsw) {
if (jsw.getLastUsageTime() < unloadBefore) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage("jsp.message.jsp_removed_idle",
+ jsw.getJspUri(), context.getContextPath(),
+ "" + (now-jsw.getLastUsageTime())));
+ }
if (jspQueue != null) {
jspQueue.remove(jsw.getUnloadHandle());
}
/**
+ * Gets the number of JSPs that are in the JSP limiter queue
+ *
+ * <p>This info may be used for monitoring purposes.
+ *
+ * @return The number of JSPs (in the webapp with which this JspServlet is
+ * associated) that are in the JSP limiter queue
+ */
+ public int getJspQueueLength() {
+ return this.rctxt.getJspQueueLength();
+ }
+
+
+ /**
+ * Gets the number of JSPs that have been unloaded.
+ *
+ * <p>This info may be used for monitoring purposes.
+ *
+ * @return The number of JSPs (in the webapp with which this JspServlet is
+ * associated) that have been unloaded
+ */
+ public int getJspUnloadCount() {
+ return this.rctxt.getJspUnloadCount();
+ }
+
+
+ /**
* <p>Look for a <em>precompilation request</em> as described in
* Section 8.4.2 of the JSP 1.2 Specification. <strong>WARNING</strong> -
* we cannot use <code>request.getParameter()</code> for this, because