You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2012/11/03 19:14:06 UTC

[1/2] git commit: Rename class as there is only one implementation now (since 5.3)

Updated Branches:
  refs/heads/5.4-js-rewrite c8260a440 -> ad0f7b6b8


Rename class as there is only one implementation now (since 5.3)


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

Branch: refs/heads/5.4-js-rewrite
Commit: ad0f7b6b886625d5aa6bb3aeccce1332e53fc772
Parents: 213421c
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Sat Nov 3 11:13:41 2012 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Sat Nov 3 11:13:41 2012 -0700

----------------------------------------------------------------------
 .../internal/services/InternalModule.java          |    2 +-
 .../services/NonPoolingRequestPageCacheImpl.java   |   98 ---------------
 .../internal/services/RequestPageCacheImpl.java    |   98 +++++++++++++++
 3 files changed, 99 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ad0f7b6b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
index 09302e1..b3f694e 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/InternalModule.java
@@ -64,7 +64,7 @@ public class InternalModule
         binder.bind(JavaScriptStackPathConstructor.class);
         binder.bind(AjaxFormUpdateController.class);
         binder.bind(ResourceDigestManager.class, ResourceDigestManagerImpl.class);
-        binder.bind(RequestPageCache.class, NonPoolingRequestPageCacheImpl.class);
+        binder.bind(RequestPageCache.class, RequestPageCacheImpl.class);
         binder.bind(ComponentInstantiatorSource.class);
         binder.bind(InternalComponentInvalidationEventHub.class);
         binder.bind(PageSource.class, PageSourceImpl.class);

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ad0f7b6b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java
deleted file mode 100644
index 43b57d0..0000000
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/NonPoolingRequestPageCacheImpl.java
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2010, 2011 The Apache Software Foundation
-//
-// Licensed 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.tapestry5.internal.services;
-
-import org.apache.tapestry5.internal.structure.Page;
-import org.apache.tapestry5.ioc.ScopeConstants;
-import org.apache.tapestry5.ioc.annotations.PostInjection;
-import org.apache.tapestry5.ioc.annotations.Scope;
-import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry5.ioc.internal.util.InternalUtils;
-import org.apache.tapestry5.ioc.services.PerthreadManager;
-import org.apache.tapestry5.ioc.services.ThreadCleanupListener;
-import org.apache.tapestry5.services.ComponentClassResolver;
-import org.slf4j.Logger;
-
-import java.util.Map;
-
-/**
- * In Tapestry 5.1, the implementation of this worked with the page pool (a pool of page instances, reserved
- * to individual requests/threads). Page pooling was deprecated in 5.2 and removed in 5.3.
- *
- * @since 5.2
- */
-@Scope(ScopeConstants.PERTHREAD)
-public class NonPoolingRequestPageCacheImpl implements RequestPageCache, ThreadCleanupListener
-{
-    private final Logger logger;
-
-    private final ComponentClassResolver resolver;
-
-    private final PageSource pageSource;
-
-    private final Map<String, Page> cache = CollectionFactory.newMap();
-
-    public NonPoolingRequestPageCacheImpl(Logger logger, ComponentClassResolver resolver, PageSource pageSource)
-    {
-        this.logger = logger;
-        this.resolver = resolver;
-        this.pageSource = pageSource;
-    }
-
-    @PostInjection
-    public void listenForThreadCleanup(PerthreadManager perthreadManager)
-    {
-        perthreadManager.addThreadCleanupListener(this);
-    }
-
-    public void threadDidCleanup()
-    {
-        for (Page page : cache.values())
-        {
-            try
-            {
-                page.detached();
-            } catch (Throwable t)
-            {
-                logger.error(String.format("Error detaching page %s: %s", page, InternalUtils.toMessage(t)), t);
-            }
-        }
-    }
-
-    public Page get(String pageName)
-    {
-        String canonical = resolver.canonicalizePageName(pageName);
-
-        Page page = cache.get(canonical);
-
-        if (page == null)
-        {
-            page = pageSource.getPage(canonical);
-
-            try
-            {
-                page.attached();
-            } catch (Throwable t)
-            {
-                throw new RuntimeException(String.format("Unable to attach page %s: %s", canonical,
-                        InternalUtils.toMessage(t)), t);
-            }
-
-            cache.put(canonical, page);
-        }
-
-        return page;
-    }
-}

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/ad0f7b6b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestPageCacheImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestPageCacheImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestPageCacheImpl.java
new file mode 100644
index 0000000..aa663da
--- /dev/null
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestPageCacheImpl.java
@@ -0,0 +1,98 @@
+// Copyright 2010, 2011, 2012 The Apache Software Foundation
+//
+// Licensed 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.tapestry5.internal.services;
+
+import org.apache.tapestry5.internal.structure.Page;
+import org.apache.tapestry5.ioc.ScopeConstants;
+import org.apache.tapestry5.ioc.annotations.PostInjection;
+import org.apache.tapestry5.ioc.annotations.Scope;
+import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
+import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.ioc.services.PerthreadManager;
+import org.apache.tapestry5.ioc.services.ThreadCleanupListener;
+import org.apache.tapestry5.services.ComponentClassResolver;
+import org.slf4j.Logger;
+
+import java.util.Map;
+
+/**
+ * In Tapestry 5.1, the implementation of this worked with the page pool (a pool of page instances, reserved
+ * to individual requests/threads). Page pooling was deprecated in 5.2 and removed in 5.3.
+ *
+ * @since 5.2
+ */
+@Scope(ScopeConstants.PERTHREAD)
+public class RequestPageCacheImpl implements RequestPageCache, ThreadCleanupListener
+{
+    private final Logger logger;
+
+    private final ComponentClassResolver resolver;
+
+    private final PageSource pageSource;
+
+    private final Map<String, Page> cache = CollectionFactory.newMap();
+
+    public RequestPageCacheImpl(Logger logger, ComponentClassResolver resolver, PageSource pageSource)
+    {
+        this.logger = logger;
+        this.resolver = resolver;
+        this.pageSource = pageSource;
+    }
+
+    @PostInjection
+    public void listenForThreadCleanup(PerthreadManager perthreadManager)
+    {
+        perthreadManager.addThreadCleanupListener(this);
+    }
+
+    public void threadDidCleanup()
+    {
+        for (Page page : cache.values())
+        {
+            try
+            {
+                page.detached();
+            } catch (Throwable t)
+            {
+                logger.error(String.format("Error detaching page %s: %s", page, InternalUtils.toMessage(t)), t);
+            }
+        }
+    }
+
+    public Page get(String pageName)
+    {
+        String canonical = resolver.canonicalizePageName(pageName);
+
+        Page page = cache.get(canonical);
+
+        if (page == null)
+        {
+            page = pageSource.getPage(canonical);
+
+            try
+            {
+                page.attached();
+            } catch (Throwable t)
+            {
+                throw new RuntimeException(String.format("Unable to attach page %s: %s", canonical,
+                        InternalUtils.toMessage(t)), t);
+            }
+
+            cache.put(canonical, page);
+        }
+
+        return page;
+    }
+}