This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 1155e89564761b6a94e2f02637f0044d9e9cabc8
Author: Andi Huber <ahu...@apache.org>
AuthorDate: Mon Jan 15 09:08:29 2018 +0100

    ISIS-1817 + ISIS-1818 added missing assignment + clarify comments
---
 .../model/models/whereami/WhereAmIModelDefault.java       | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/whereami/WhereAmIModelDefault.java
 
b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/whereami/WhereAmIModelDefault.java
index ff06907..9b335ba 100644
--- 
a/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/whereami/WhereAmIModelDefault.java
+++ 
b/core/viewer-wicket-model/src/main/java/org/apache/isis/viewer/wicket/model/models/whereami/WhereAmIModelDefault.java
@@ -72,7 +72,7 @@ class WhereAmIModelDefault implements WhereAmIModel {
        @Override
        public Stream<EntityModel> streamParentChainReversed() {
                if(!isWhereAmIEnabled)
-                       return Stream.empty(); // unexpected call, we could log 
a warning
+                       return Stream.empty(); //[ahuber] unexpected call, we 
could log a warning
                
                return reversedChainOfParents.stream()
                .map(this::toEntityModel);
@@ -89,11 +89,20 @@ class WhereAmIModelDefault implements WhereAmIModel {
        private void overrideFromConfigIfNew(IsisConfiguration configuration) {
                
                //[ahuber] without evidence that this significantly improves 
performance, 
-               // we use the smart update idiom here ...
-               final int newConfigHash = 
System.identityHashCode(configuration);
+               // (skipping 2 hash-table lookups) we use the smart update 
idiom here ...
+               //
+               // Note: Updates are expected to occur only once per 
application life-cycle,
+               // however this class might be loaded by a class-loader, that 
endures multiple
+               // application life-cycles. Chances of hash-collisions are 
simply neglected.
+               
+               // that's the hash of the object (we don't care about the 
actual config values)
+               // assuming that, we get a new (immutable) config instance each 
app's life-cycle:
+               final int newConfigHash = 
System.identityHashCode(configuration); 
                if(newConfigHash == configHash)
                        return;
                
+               configHash = newConfigHash;
+               
                isWhereAmIEnabled = configuration.getBoolean(
                                CONFIG_KEY_IS_WHERE_AM_I_FEATURE_ENABLED,
                                IS_WHERE_AM_I_FEATURE_ENABLED_DEFAULT);

-- 
To stop receiving notification emails like this one, please contact
danhayw...@apache.org.

Reply via email to