You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2019/12/13 18:42:27 UTC
[brooklyn-server] branch master updated (1dd4d49 -> 7a67dd2)
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git.
from 1dd4d49 This closes #1060
new 4324eb3 Reseting expiration on each session request
new 8c6f91b max inactive time = 3601
new 7a67dd2 This closes #1073
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../rest/util/MultiSessionAttributeAdapter.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
[brooklyn-server] 01/03: Reseting expiration on each session request
Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 4324eb3acc9aa1cda1ae66eab184905c7421044b
Author: Juan Cabrerizo <ju...@cloudsoft.io>
AuthorDate: Thu Dec 5 11:04:44 2019 +0000
Reseting expiration on each session request
---
.../rest/util/MultiSessionAttributeAdapter.java | 25 ++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
index 9d5556c..848e222 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
@@ -80,7 +80,7 @@ public class MultiSessionAttributeAdapter {
private static final String KEY_PREFERRED_SESSION_HANDLER_INSTANCE = "org.apache.brooklyn.server.PreferredSessionHandlerInstance";
private static final String KEY_IS_PREFERRED = "org.apache.brooklyn.server.IsPreferred";
- private static final int MAX_INACTIVE_INTERVAL = 3601;
+ private static final int MAX_INACTIVE_INTERVAL = 600;
private static final Object PREFERRED_SYMBOLIC_NAME =
"org.apache.cxf.cxf-rt-transports-http";
@@ -99,6 +99,7 @@ public class MultiSessionAttributeAdapter {
protected MultiSessionAttributeAdapter(HttpSession preferredSession, HttpSession localSession) {
this.preferredSession = preferredSession;
this.localSession = localSession;
+ resetExpiration();
}
public static MultiSessionAttributeAdapter of(HttpServletRequest r) {
@@ -137,7 +138,6 @@ public class MultiSessionAttributeAdapter {
(preferredSession!=null ? info(preferredSession) : "none, willl make new session in "+info(preferredHandler)));
}
if (preferredSession!=null) {
- preferredSession.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL);
return preferredSession;
}
if (preferredHandler!=null) {
@@ -145,7 +145,6 @@ public class MultiSessionAttributeAdapter {
HttpSession result = preferredHandler.newHttpSession(optionalRequest);
// bigger than HouseKeeper.sessionScavengeInterval: 3600
// https://www.eclipse.org/jetty/documentation/9.4.x/session-configuration-housekeeper.html
- result.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL);
if (log.isTraceEnabled()) {
log.trace("Creating new session "+info(result)+" to be preferred for " + info(optionalRequest, localSession));
}
@@ -154,7 +153,6 @@ public class MultiSessionAttributeAdapter {
// the server has a preferred handler, but no session yet; fall back to marking on the session
log.warn("No request so cannot create preferred session at preferred handler "+info(preferredHandler)+" for "+info(optionalRequest, localSession)+"; will exceptionally mark the calling session as the preferred one");
markSessionAsPreferred(localSession, " (request came in for "+info(optionalRequest, localSession)+")");
- localSession.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL);
return localSession;
} else {
// shouldn't come here; at minimum it should have returned the local session's handler
@@ -408,8 +406,8 @@ public class MultiSessionAttributeAdapter {
if (ss!=null) {
ss.setAttribute(name, value);
}
- return;
}
+ return;
} else {
if (!setLocalValuesAlso) {
// can't do all, but at least to local
@@ -432,8 +430,8 @@ public class MultiSessionAttributeAdapter {
if (ss!=null) {
ss.removeAttribute(name);
}
- return;
}
+ return;
} else {
if (!setLocalValuesAlso) {
// can't do all, but at least to local
@@ -481,4 +479,19 @@ public class MultiSessionAttributeAdapter {
return getPreferredSession().getId();
}
+ public MultiSessionAttributeAdapter resetExpiration() {
+ // force all sessions with this ID to be marked used so they are not expired
+ // (if _any_ session with this ID is expired, then they all are, even if another
+ // with the same ID is in use or has a later expiry)
+ Handler[] hh = getSessionHandlers();
+ if (hh!=null) {
+ for (Handler h: hh) {
+ Session ss = ((SessionHandler)h).getSession(getId());
+ if (ss!=null) {
+ ss.setMaxInactiveInterval(MAX_INACTIVE_INTERVAL);
+ }
+ }
+ }
+ return this;
+ }
}
[brooklyn-server] 03/03: This closes #1073
Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 7a67dd288f9dfb28c8d2c21d9cf6f5cf126dc1e9
Merge: 1dd4d49 8c6f91b
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Fri Dec 13 14:31:00 2019 +0000
This closes #1073
.../rest/util/MultiSessionAttributeAdapter.java | 23 +++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
[brooklyn-server] 02/03: max inactive time = 3601
Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git
commit 8c6f91bd81d5fc19921a74c15b17c24aaf7631ec
Author: Juan Cabrerizo <ju...@cloudsoft.io>
AuthorDate: Thu Dec 5 11:09:39 2019 +0000
max inactive time = 3601
---
.../org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
index 848e222..70e9c23 100644
--- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
+++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/util/MultiSessionAttributeAdapter.java
@@ -80,7 +80,7 @@ public class MultiSessionAttributeAdapter {
private static final String KEY_PREFERRED_SESSION_HANDLER_INSTANCE = "org.apache.brooklyn.server.PreferredSessionHandlerInstance";
private static final String KEY_IS_PREFERRED = "org.apache.brooklyn.server.IsPreferred";
- private static final int MAX_INACTIVE_INTERVAL = 600;
+ private static final int MAX_INACTIVE_INTERVAL = 3601;
private static final Object PREFERRED_SYMBOLIC_NAME =
"org.apache.cxf.cxf-rt-transports-http";