You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/03/24 12:54:56 UTC

[2/3] git commit: ISIS-367: removing IsisContextForWicket since no longer used....

ISIS-367: removing IsisContextForWicket since no longer used....

... and removing thread counting from AuthenticatedWebSessionForIsis.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/ace2b5b4
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/ace2b5b4
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/ace2b5b4

Branch: refs/heads/master
Commit: ace2b5b4814c99f4b2d0718bc02941ffaed7c9ca
Parents: 0448f2d
Author: Dan Haywood <da...@apache.org>
Authored: Wed Mar 20 07:25:23 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Thu Mar 21 11:26:38 2013 +0000

----------------------------------------------------------------------
 .../viewer/IsisWicketUnsecuredApplication.java     |    6 +-
 .../integration/isis/DeploymentTypeAbstract.java   |    9 +-
 .../integration/isis/IsisContextForWicket.java     |  370 ---------------
 .../viewer/integration/isis/WicketServer.java      |   10 +
 .../integration/isis/WicketServerExploration.java  |   39 --
 .../integration/isis/WicketServerPrototype.java    |    8 +
 .../wicket/AuthenticatedWebSessionForIsis.java     |   37 +--
 .../integration/wicket/WebRequestCycleForIsis.java |    3 -
 ...nticatedWebSessionForIsis_ThreadManagement.java |   78 ---
 9 files changed, 23 insertions(+), 537 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketUnsecuredApplication.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketUnsecuredApplication.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketUnsecuredApplication.java
index e22ca86..88ed44c 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketUnsecuredApplication.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/IsisWicketUnsecuredApplication.java
@@ -151,11 +151,7 @@ public class IsisWicketUnsecuredApplication extends WebApplication implements Co
     }
 
     private DeploymentType determineDeploymentType() {
-        if(usesDevelopmentConfig()) {
-            return new WicketServerPrototype();
-        } else {
-            return new WicketServer();
-        }
+        return usesDevelopmentConfig() ? new WicketServerPrototype() : new WicketServer();
     }
 
     private IsisConfigurationBuilder createConfigBuilder(ServletContext servletContext) {

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/DeploymentTypeAbstract.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/DeploymentTypeAbstract.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/DeploymentTypeAbstract.java
index b266b0b..a12dccd 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/DeploymentTypeAbstract.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/DeploymentTypeAbstract.java
@@ -19,8 +19,6 @@
 
 package org.apache.isis.viewer.wicket.viewer.integration.isis;
 
-import org.apache.wicket.Application;
-
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
 import org.apache.isis.core.runtime.system.ContextCategory;
 import org.apache.isis.core.runtime.system.DeploymentType;
@@ -28,17 +26,12 @@ import org.apache.isis.core.runtime.system.Splash;
 
 /**
  * Simple adapter for Isis' {@link DeploymentType} class, specifying that the
- * {@link IsisContextForWicket.WicketContextCategory} is used as the
+ * {@link ContextCategory#THREADLOCAL} is used as the
  * {@link ContextCategory}.
- * 
- * <p>
- * TODO: should somehow tie this in with Wicket's own
- * {@link Application#getConfigurationType() configuration mode}.
  */
 public abstract class DeploymentTypeAbstract extends DeploymentType {
 
     public DeploymentTypeAbstract(final String name, final DeploymentCategory category) {
-        //super(name, category, new IsisContextForWicket.WicketContextCategory(), null, Splash.NO_SHOW);
         super(name, category, ContextCategory.THREADLOCAL, null, Splash.NO_SHOW);
     }
 

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
deleted file mode 100644
index 6fe41bc..0000000
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/IsisContextForWicket.java
+++ /dev/null
@@ -1,370 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.integration.isis;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import com.google.common.base.Function;
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Maps;
-
-import org.apache.log4j.Logger;
-import org.apache.wicket.Session;
-
-import org.apache.isis.core.commons.authentication.AuthenticationSession;
-import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
-import org.apache.isis.core.runtime.system.ContextCategory;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.internal.InitialisationSession;
-import org.apache.isis.core.runtime.system.session.IsisSession;
-import org.apache.isis.core.runtime.system.session.IsisSessionFactory;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-/**
- * Implementation of Isis' {@link IsisContext}, associating a
- * {@link IsisSession} with a Wicket {@link Session}.
- * 
- * <p>
- * This implementation also takes multi-threading into account, so that the
- * browser can submit multiple requests on the same session simultaneously (eg
- * to render an image of a pojo).
- */
-public class IsisContextForWicket extends IsisContext {
-
-    private static final Logger LOG = Logger.getLogger(IsisContextForWicket.class);
-    
-    public static class WicketContextCategory extends ContextCategory {
-
-        @Override
-        public boolean canSpecifyViewers(final List<String> viewers) {
-            return false;
-        }
-
-        @Override
-        public void initContext(final IsisSessionFactory sessionFactory) {
-            new IsisContextForWicket(ContextReplacePolicy.NOT_REPLACEABLE, SessionClosePolicy.EXPLICIT_CLOSE, sessionFactory);
-        }
-    }
-
-    private static final class GetSessionIdFunction implements Function<SessionKey, String> {
-        @Override
-        public String apply(final SessionKey from) {
-            return from.getId();
-        }
-    }
-
-    private enum SessionType {
-        WICKET {
-            @Override
-            public String getId(SessionKey sessionKey) {
-                return sessionKey.wicketSession.getId();
-            }
-
-            @Override
-            public IsisSession beginInteraction(final SessionKey sessionKey, final AuthenticationSession authSession, final IsisSessionFactory sessionFactory, final Map<SessionKey, IsisSession> sessionMap) {
-                final AuthenticatedWebSessionForIsis wicketSession = sessionKey.wicketSession;
-                synchronized (wicketSession) {
-                    // we don't apply any session close policy here;
-                    // there could be multiple threads using a session.
-
-                    final String wicketSessionId = wicketSession.getId();
-                
-                    final int before = wicketSession.getThreadUsage();
-                    wicketSession.registerUseByThread();
-                    final int after = wicketSession.getThreadUsage();
-            
-                    String logMsg = ""; 
-                    IsisSession isisSession = sessionMap.get(sessionKey);
-                    try {
-                        if (isisSession != null) {
-                            logMsg = "BUMP_UP";
-                        } else {
-                            isisSession = sessionFactory.openSession(authSession);
-                            // put into map prior to opening, so that subsequent calls to
-                            // getSessionInstance() will find this new session.
-                            sessionMap.put(sessionKey, isisSession);
-                            isisSession.open();
-                            
-                            logMsg = "NEW    ";
-                        }
-                
-                        return isisSession;
-                    } finally {
-                        if(LOG.isDebugEnabled()) {
-                            LOG.debug(String.format("wicketSession: %s OPEN  %d -> %d %s %s %s", wicketSessionId, before, after, logMsg, authSession.getUserName(), isisSession.getId()));
-                        }
-                    }
-                }
-            }
-
-            @Override
-            public void endInteraction(SessionKey sessionKey, final Map<SessionKey, IsisSession> sessionMap) {
-                final AuthenticatedWebSessionForIsis wicketSession = sessionKey.wicketSession;
-                synchronized (wicketSession) {
-                    final String wicketSessionId = wicketSession.getId();
-                    
-                    final int before = wicketSession.getThreadUsage();
-                    final boolean shouldClose = wicketSession.deregisterUseByThread();
-                    final int after = wicketSession.getThreadUsage();
-
-                    final IsisSession isisSession = sessionMap.get(sessionKey);
-                    AuthenticationSession authSession = null;
-                    String logMsg = ""; 
-                    try {
-                        if (isisSession == null) {
-                            // nothing to be done !?!?
-                            logMsg = "NO_SESSION";
-                            return; 
-                        }
-                        authSession = isisSession.getAuthenticationSession();
-                        
-                        if (!shouldClose) {
-                            logMsg = "BUMP_DOWN ";
-                            // don't remove from map    
-                            return;
-                        } 
-                        
-                        isisSession.close();
-                        logMsg = "DISCARDING";
-                        
-                        // the remove happens after closing, any calls to getSessionInstance()
-                        // made while closing will still find this session
-                        sessionMap.remove(sessionKey);
-                        
-                    } finally {
-                        if(LOG.isDebugEnabled()) {
-                            LOG.debug(String.format("wicketSession: %s CLOSE %d -> %d %s %s %s", wicketSessionId, before, after, logMsg, (authSession != null? authSession.getUserName(): "[null]"), (isisSession != null? isisSession.getId(): "[null]")));
-                        }
-                    }
-                }
-            }
-
-            @Override
-            public boolean equals(SessionKey sessionKey, SessionKey other) {
-                return sessionKey.wicketSession == other.wicketSession;
-            }
-
-            @Override
-            public int hashCode(SessionKey sessionKey) {
-                return sessionKey.wicketSession.hashCode();
-            }
-        },
-        THREAD {
-            @Override
-            public String getId(SessionKey sessionKey) {
-                return ""+sessionKey.thread.getId();
-            }
-
-            @Override
-            public IsisSession beginInteraction(final SessionKey sessionKey, final AuthenticationSession authSession, final IsisSessionFactory sessionFactory, final Map<SessionKey, IsisSession> sessionMap) {
-                // auto-close if required
-                endInteraction(sessionKey, sessionMap);
-                
-                final String threadName = sessionKey.thread.getName();
-                final IsisSession isisSession = sessionFactory.openSession(authSession);
-                try {
-                    sessionMap.put(sessionKey, isisSession);
-                    isisSession.open();
-                    return isisSession;
-                } finally {
-                    if(LOG.isDebugEnabled()) {
-                        LOG.debug(String.format("threadSession: %s OPEN  %s %s", threadName, authSession.getUserName(), isisSession.getId()));
-                    }
-                }
-            }
-            
-
-            @Override
-            public void endInteraction(SessionKey sessionKey, Map<SessionKey, IsisSession> sessionMap) {
-                final IsisSession isisSession = sessionMap.get(sessionKey);
-                if(isisSession == null) {
-                    return; // nothing to do
-                }
-                final String threadName = sessionKey.thread.getName();
-                final AuthenticationSession authSession = isisSession.getAuthenticationSession();
-                try {
-                    
-                    isisSession.close();
-                    sessionMap.remove(sessionKey);
-                } finally {
-                    if(LOG.isDebugEnabled()) {
-                        LOG.debug(String.format("threadSession: %s CLOSE %s %s", threadName, authSession.getUserName(), isisSession.getId()));
-                    }
-                }
-            }
-
-            @Override
-            public boolean equals(SessionKey sessionKey, SessionKey other) {
-                return sessionKey.thread == other.thread;
-            }
-
-            @Override
-            public int hashCode(SessionKey sessionKey) {
-                return sessionKey.thread.hashCode();
-            }
-        };
-
-        public abstract String getId(SessionKey sessionKey);
-
-        public abstract IsisSession beginInteraction(final SessionKey sessionKey, final AuthenticationSession authSession, final IsisSessionFactory sessionFactory, final Map<SessionKey, IsisSession> sessionMap);
-
-        public abstract void endInteraction(SessionKey sessionKey, final Map<SessionKey, IsisSession> sessionMap);
-
-        public abstract boolean equals(SessionKey sessionKey, SessionKey other);
-        public abstract int hashCode(SessionKey sessionKey);
-    }
-    
-    private static class SessionKey {
-        private final SessionType type;
-        private final AuthenticatedWebSessionForIsis wicketSession;
-        private final Thread thread;
-        private SessionKey(SessionType type, Session wicketSession, Thread thread) {
-            this.type = type;
-            this.wicketSession = (AuthenticatedWebSessionForIsis) wicketSession;
-            this.thread = thread;
-        }
-        public String getId() {
-            return type.getId(this);
-        }
-        static SessionKey get() {
-            return Session.exists()? new SessionKey(SessionType.WICKET, Session.get(), null): new SessionKey(SessionType.THREAD, null, Thread.currentThread());
-        }
-        public IsisSession beginInteraction(final AuthenticationSession authSession, final IsisSessionFactory sessionFactory, final Map<SessionKey, IsisSession> sessionMap) {
-            synchronized (sessionMap) {
-                return type.beginInteraction(this, authSession, sessionFactory, sessionMap);
-            }
-        }
-        public void endInteraction(final Map<SessionKey, IsisSession> sessionMap) {
-            synchronized (sessionMap) {
-                type.endInteraction(this, sessionMap);
-            }
-        }
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj)
-                return true;
-            if (obj == null)
-                return false;
-            if (getClass() != obj.getClass())
-                return false;
-            SessionKey other = (SessionKey) obj;
-            if (type != other.type)
-                return false;
-            return type.equals(this, other);
-        }
-        @Override
-        public int hashCode() {
-            return type.hashCode(this);
-        }
-        @Override
-        public String toString() {
-            return "SessionKey[" + type + "]:id=" + getId();
-        }
-        
-    }
-
-    
-    /**
-     * Only used while bootstrapping, corresponding to the
-     * {@link InitialisationSession}.
-     */
-    private IsisSession bootstrapSession;
-    /**
-     * Maps (our custom) {@link AuthenticatedWebSessionForIsis Wicket session}s
-     * to vanilla {@link IsisSession}s.
-     */
-    private final Map<SessionKey, IsisSession> sessionMap = Maps.newHashMap();
-
-    protected IsisContextForWicket(final ContextReplacePolicy replacePolicy, final SessionClosePolicy sessionClosePolicy, final IsisSessionFactory sessionFactory) {
-        super(replacePolicy, sessionClosePolicy, sessionFactory);
-    }
-
-    @Override
-    public String[] allSessionIds() {
-        final Collection<String> transform = Collections2.transform(sessionMap.keySet(), new GetSessionIdFunction());
-        return transform.toArray(new String[0]);
-    }
-
-    @Override
-    protected void closeAllSessionsInstance() {
-        throw new NotYetImplementedException();
-    }
-
-    @Override
-    protected IsisSession getSessionInstance(final String sessionId) {
-        throw new NotYetImplementedException();
-    }
-
-    @Override
-    public IsisSession getSessionInstance() {
-        // special case handling if still bootstrapping
-        if (bootstrapSession != null) {
-            return bootstrapSession;
-        }
-        SessionKey sessionKey = SessionKey.get();
-        return sessionMap.get(sessionKey);
-    }
-
-    @Override
-    public IsisSession openSessionInstance(final AuthenticationSession session) {
-
-        // special case handling if still bootstrapping
-        if (session instanceof InitialisationSession) {
-            bootstrapSession = getSessionFactory().openSession(session);
-            bootstrapSession.open();
-            return bootstrapSession;
-        }
-
-        // otherwise, regular processing
-        return openSessionOrRegisterUsageOnExisting(session);
-    }
-
-    private synchronized IsisSession openSessionOrRegisterUsageOnExisting(final AuthenticationSession authSession) {
-        SessionKey sessionKey = SessionKey.get();
-        return sessionKey.beginInteraction(authSession, getSessionFactoryInstance(), sessionMap);
-    }
-
-    @Override
-    public synchronized void closeSessionInstance() {
-        // special case handling if still bootstrapping
-        if (bootstrapSession != null) {
-
-            bootstrapSession.close();
-            bootstrapSession = null;
-            return;
-        }
-
-        // otherwise, regular processing
-        closeSessionOrDeregisterUsageOnExisting();
-    }
-
-    private synchronized void closeSessionOrDeregisterUsageOnExisting() {
-        SessionKey sessionKey = SessionKey.get();
-        sessionKey.endInteraction(sessionMap);
-    }
-
-    @Override
-    public String debugTitle() {
-        return "Wicket Context";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServer.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServer.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServer.java
index 69240ad..d9d597b 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServer.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServer.java
@@ -19,11 +19,21 @@
 
 package org.apache.isis.viewer.wicket.viewer.integration.isis;
 
+import org.apache.wicket.settings.def.ApplicationSettings;
+
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
 import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication;
+import org.apache.isis.viewer.wicket.viewer.IsisWicketUnsecuredApplication;
 
 /**
  * {@link DeploymentType} for production usage.
+ * 
+ * <p>
+ * In {@link IsisWicketApplication} and {@link IsisWicketUnsecuredApplication} there
+ * is logic to select either this {@link DeploymentType} or {@link WicketServerPrototype}
+ * depending on the value of Wicket's own
+ * {@link Application#getConfigurationType() configuration mode}. 
  */
 public class WicketServer extends DeploymentTypeAbstract {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerExploration.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerExploration.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerExploration.java
deleted file mode 100644
index 53312bf..0000000
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerExploration.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.integration.isis;
-
-import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
-import org.apache.isis.core.runtime.system.DeploymentType;
-
-/**
- * {@link DeploymentType} for exploration usage.
- * 
- * <p>
- * TODO: this is currently only partly honoured; exploration actions are shown
- * and the correct object store is defaulted (ie in-memory); however Wicket
- * Objects will always pop up a login dialog.
- */
-public class WicketServerExploration extends DeploymentTypeAbstract {
-
-    public WicketServerExploration() {
-        super("WICKET_SERVER_EXPLORATION", DeploymentCategory.EXPLORING);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerPrototype.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerPrototype.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerPrototype.java
index ad925e8..e0a5bd4 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerPrototype.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/isis/WicketServerPrototype.java
@@ -21,9 +21,17 @@ package org.apache.isis.viewer.wicket.viewer.integration.isis;
 
 import org.apache.isis.core.metamodel.deployment.DeploymentCategory;
 import org.apache.isis.core.runtime.system.DeploymentType;
+import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication;
+import org.apache.isis.viewer.wicket.viewer.IsisWicketUnsecuredApplication;
 
 /**
  * {@link DeploymentType} for prototype usage.
+ * 
+ * <p>
+ * In {@link IsisWicketApplication} and {@link IsisWicketUnsecuredApplication} there
+ * is logic to select either this {@link DeploymentType} or {@link WicketServer}
+ * depending on the value of Wicket's own
+ * {@link Application#getConfigurationType() configuration mode}. 
  */
 public class WicketServerPrototype extends DeploymentTypeAbstract {
 

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
index b290b51..6d2c422 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/AuthenticatedWebSessionForIsis.java
@@ -58,7 +58,6 @@ public class AuthenticatedWebSessionForIsis extends AuthenticatedWebSession impl
     }
 
     private AuthenticationSession authenticationSession;
-    private int threadUsages;
 
     public AuthenticatedWebSessionForIsis(final Request request) {
         super(Ensure.ensureThatArg(request, is(not(nullValue(Request.class)))));
@@ -95,39 +94,9 @@ public class AuthenticatedWebSessionForIsis extends AuthenticatedWebSession impl
         return (WebClientInfo) super.getClientInfo();
     }
 
-    // /////////////////////////////////////////////////////////
-    // Thread counting
-    // /////////////////////////////////////////////////////////
-
-    /**
-     * Capture fact that this session is currently being used by a thread.
-     * 
-     * <p>
-     * There could be several concurrent requests all of which will use the same
-     * Session; for example to obtain img resources for entities. This counter
-     * keeps track of one of these threadUsages, when it gets back down to zero
-     * then we can close the thread.
-     * @return 
-     * 
-     * @see #deregisterUseByThread()
-     */
-    public int registerUseByThread() {
-        threadUsages++;
-        return getThreadUsage();
-    }
-
-    /**
-     * @see #registerUseByThread()
-     * @return whether the session is no longer used by any threadUsages.
-     */
-    public boolean deregisterUseByThread() {
-        threadUsages--;
-        return threadUsages <= 0;
-    }
-
-    public int getThreadUsage() {
-        return threadUsages;
-    }
+    // /////////////////////////////////////////////////
+    // Dependencies
+    // /////////////////////////////////////////////////
 
     protected AuthenticationManager getAuthenticationManager() {
         return IsisContext.getAuthenticationManager();

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
index c5b44b0..17a1e77 100644
--- a/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
+++ b/component/viewer/wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/integration/wicket/WebRequestCycleForIsis.java
@@ -65,9 +65,6 @@ public class WebRequestCycleForIsis extends AbstractRequestCycleListener {
         if (wicketSession == null) {
             return;
         }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("thread usage: " + wicketSession.getThreadUsage());
-        }
         final AuthenticationSession authenticationSession = wicketSession.getAuthenticationSession();
         if (authenticationSession == null) {
             return;

http://git-wip-us.apache.org/repos/asf/isis/blob/ace2b5b4/component/viewer/wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_ThreadManagement.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_ThreadManagement.java b/component/viewer/wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_ThreadManagement.java
deleted file mode 100644
index 8a339e0..0000000
--- a/component/viewer/wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_ThreadManagement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Locale;
-
-import org.apache.wicket.request.Request;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-public class AuthenticatedWebSessionForIsis_ThreadManagement {
-
-    @Rule
-    public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
-    private AuthenticatedWebSessionForIsis webSession;
-
-    @Mock
-    private Request stubRequest;
-
-    @Before
-    public void setUp() throws Exception {
-        context.checking(new Expectations() {
-            {
-                // must provide explicit expectation, since Locale is final.
-                allowing(stubRequest).getLocale();
-                will(returnValue(Locale.getDefault()));
-
-                // stub everything else out
-                ignoring(stubRequest);
-            }
-        });
-
-        webSession = new AuthenticatedWebSessionForIsis(stubRequest);
-    }
-
-    @Test
-    public void testRegisterUseByThread() {
-        assertThat(webSession.getThreadUsage(), is(0));
-        webSession.registerUseByThread();
-        assertThat(webSession.getThreadUsage(), is(1));
-    }
-
-    @Test
-    public void testDeregisterUseByThread() {
-        webSession.registerUseByThread();
-        assertThat(webSession.getThreadUsage(), is(1));
-        webSession.deregisterUseByThread();
-        assertThat(webSession.getThreadUsage(), is(0));
-    }
-}