Author: remy.maucherat(a)jboss.com
Date: 2009-06-12 18:43:15 -0400 (Fri, 12 Jun 2009)
New Revision: 1112
Modified:
trunk/java/org/apache/catalina/session/PersistentManagerBase.java
trunk/java/org/apache/catalina/startup/HostConfig.java
trunk/webapps/docs/changelog.xml
Log:
- Fix redeploy resources order.
- Fix session activity in persistence manager.
Modified: trunk/java/org/apache/catalina/session/PersistentManagerBase.java
===================================================================
--- trunk/java/org/apache/catalina/session/PersistentManagerBase.java 2009-06-12 15:53:50
UTC (rev 1111)
+++ trunk/java/org/apache/catalina/session/PersistentManagerBase.java 2009-06-12 22:43:15
UTC (rev 1112)
@@ -814,6 +814,9 @@
((StandardSession)session).tellNew();
add(session);
((StandardSession)session).activate();
+ // endAccess() to ensure timeouts happen correctly.
+ // access() to keep access count correct or it will end up negative
+ session.access();
session.endAccess();
return (session);
@@ -1050,6 +1053,12 @@
int timeIdle = // Truncate, do not round up
(int) ((timeNow - session.getLastAccessedTime()) / 1000L);
if (timeIdle > maxIdleSwap && timeIdle > minIdleSwap)
{
+ if (sessions[i] instanceof StandardSession) {
+ if (((StandardSession) sessions[i]).accessCount.get() > 0)
{
+ // Session is currently being accessed - skip it
+ continue;
+ }
+ }
if (log.isDebugEnabled())
log.debug(sm.getString
("persistentManager.swapMaxIdle",
@@ -1094,6 +1103,12 @@
int timeIdle = // Truncate, do not round up
(int) ((timeNow - sessions[i].getLastAccessedTime()) / 1000L);
if (timeIdle > minIdleSwap) {
+ if (sessions[i] instanceof StandardSession) {
+ if (((StandardSession) sessions[i]).accessCount.get() > 0) {
+ // Session is currently being accessed - skip it
+ continue;
+ }
+ }
if(log.isDebugEnabled())
log.debug(sm.getString
("persistentManager.swapTooManyActive",
Modified: trunk/java/org/apache/catalina/startup/HostConfig.java
===================================================================
--- trunk/java/org/apache/catalina/startup/HostConfig.java 2009-06-12 15:53:50 UTC (rev
1111)
+++ trunk/java/org/apache/catalina/startup/HostConfig.java 2009-06-12 22:43:15 UTC (rev
1112)
@@ -779,8 +779,6 @@
}
}
context.setConfigFile(xml.getAbsolutePath());
- deployedApp.redeployResources.put
- (xml.getAbsolutePath(), new Long(xml.lastModified()));
} else {
context = (Context) Class.forName(contextClass).newInstance();
}
@@ -789,6 +787,11 @@
deployedApp.redeployResources.put
(war.getAbsolutePath(), new Long(war.lastModified()));
+ if (deployXML && xml.exists()) {
+ deployedApp.redeployResources.put
+ (xml.getAbsolutePath(), new Long(xml.lastModified()));
+ }
+
if (context instanceof Lifecycle) {
Class<?> clazz = Class.forName(host.getConfigClass());
LifecycleListener listener =
@@ -882,6 +885,7 @@
try {
Context context = null;
File xml = new File(dir, Constants.ApplicationContextXml);
+ File xmlCopy = null;
if (deployXML && xml.exists()) {
// Will only do this on initial deployment. On subsequent
// deployments the copied xml file means we'll use
@@ -899,7 +903,7 @@
}
}
configBase.mkdirs();
- File xmlCopy = new File(configBase, file + ".xml");
+ xmlCopy = new File(configBase(), file + ".xml");
InputStream is = null;
OutputStream os = null;
try {
@@ -920,8 +924,6 @@
}
}
context.setConfigFile(xmlCopy.getAbsolutePath());
- deployedApp.redeployResources.put
- (xmlCopy.getAbsolutePath(), new Long(xmlCopy.lastModified()));
} else {
context = (Context) Class.forName(contextClass).newInstance();
}
@@ -937,6 +939,10 @@
host.addChild(context);
deployedApp.redeployResources.put(dir.getAbsolutePath(),
new Long(dir.lastModified()));
+ if (xmlCopy != null) {
+ deployedApp.redeployResources.put
+ (xmlCopy.getAbsolutePath(), new Long(xmlCopy.lastModified()));
+ }
addWatchedResources(deployedApp, dir.getAbsolutePath(), context);
} catch (Throwable t) {
log.error(sm.getString("hostConfig.deployDir.error", file), t);
Modified: trunk/webapps/docs/changelog.xml
===================================================================
--- trunk/webapps/docs/changelog.xml 2009-06-12 15:53:50 UTC (rev 1111)
+++ trunk/webapps/docs/changelog.xml 2009-06-12 22:43:15 UTC (rev 1112)
@@ -96,6 +96,12 @@
<fix>
<bug>47299</bug>: Expose Container.fireContainerEvent, which became
public long ago. (remm)
</fix>
+ <fix>
+ Two bugs related to session activity with the persistent manager. (markt)
+ </fix>
+ <fix>
+ <bug>47343</bug>: Fix redeploy resources order. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
Show replies by date