You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/03/03 01:25:14 UTC
[isis] branch master updated: ISIS-2296: remove unnecessary sync
lock (different threads operate on their own session stack)
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new b79d9c9 ISIS-2296: remove unnecessary sync lock (different threads operate on their own session stack)
b79d9c9 is described below
commit b79d9c97af50f9d356933207c1b2414b51062151
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Mar 3 02:24:51 2020 +0100
ISIS-2296: remove unnecessary sync lock (different threads operate on
their own session stack)
---
.../session/IsisSessionFactoryDefault.java | 40 ++++++++++------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisSessionFactoryDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisSessionFactoryDefault.java
index 7fa00c5..bbab2bf 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisSessionFactoryDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/session/IsisSessionFactoryDefault.java
@@ -90,7 +90,6 @@ public class IsisSessionFactoryDefault implements IsisSessionFactory, IsisSessio
private IsisLocaleInitializer localeInitializer;
private IsisTimeZoneInitializer timeZoneInitializer;
- private final Object $lock = new Object[0];
//@PostConstruct .. too early, needs services to be provisioned first
@EventListener
@@ -140,18 +139,17 @@ public class IsisSessionFactoryDefault implements IsisSessionFactory, IsisSessio
@Override
public IsisSession openSession(@NonNull final AuthenticationSession authenticationSession) {
- synchronized($lock) {
- val isisSession = getAuthenticationSessionOverride()
- .map(authenticationSessionOverride->new IsisSession(metaModelContext, authenticationSessionOverride))
- .orElseGet(()->new IsisSession(metaModelContext, authenticationSession));
-
- isisSessionStack.get().push(isisSession);
- if(isisSessionStack.get().size()==1) {
- runtimeEventService.fireSessionOpened(isisSession); // only fire on top-level session
- }
- return isisSession;
+ val isisSession = getAuthenticationSessionOverride()
+ .map(authenticationSessionOverride->new IsisSession(metaModelContext, authenticationSessionOverride))
+ .orElseGet(()->new IsisSession(metaModelContext, authenticationSession));
+
+ isisSessionStack.get().push(isisSession);
+ if(isisSessionStack.get().size()==1) {
+ runtimeEventService.fireSessionOpened(isisSession); // only fire on top-level session
}
+ return isisSession;
+
}
@Override
@@ -205,18 +203,18 @@ public class IsisSessionFactoryDefault implements IsisSessionFactory, IsisSessio
// -- HELPER - SESSION STACK CLOSING
private void closeSessionStackDownToStackSize(int downToStackSize) {
- synchronized($lock) {
- val stack = isisSessionStack.get();
- while(stack.size()>downToStackSize) {
- val isisSession = stack.pop();
- if(stack.isEmpty()) {
- runtimeEventService.fireSessionClosing(isisSession); // only fire on top-level session
- }
- }
- if(downToStackSize == 0) {
- isisSessionStack.remove();
+
+ val stack = isisSessionStack.get();
+ while(stack.size()>downToStackSize) {
+ val isisSession = stack.pop();
+ if(stack.isEmpty()) {
+ runtimeEventService.fireSessionClosing(isisSession); // only fire on top-level session
}
}
+ if(downToStackSize == 0) {
+ isisSessionStack.remove();
+ }
+
}
// -- HELPER - SUDO SUPPORT