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 2010/03/12 06:21:19 UTC

svn commit: r922147 - in /tapestry/tapestry5/trunk: src/site/apt/index.apt tapestry-ioc/src/site/apt/reload.apt tapestry-ioc/src/site/site.xml

Author: hlship
Date: Fri Mar 12 05:21:19 2010
New Revision: 922147

URL: http://svn.apache.org/viewvc?rev=922147&view=rev
Log:
TAP5-1013: Add documentation about service reloading

Added:
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt   (with props)
Modified:
    tapestry/tapestry5/trunk/src/site/apt/index.apt
    tapestry/tapestry5/trunk/tapestry-ioc/src/site/site.xml

Modified: tapestry/tapestry5/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/src/site/apt/index.apt?rev=922147&r1=922146&r2=922147&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/trunk/src/site/apt/index.apt Fri Mar 12 05:21:19 2010
@@ -34,6 +34,8 @@ What is Apache Tapestry?
 
 New And Of Note
 
+  * Service <implementation> classes may now be {{{tapestry-ioc/guide/reload.html}live reloaded}}, much like page and component classes. 
+
   * New {{{apidocs/org/apache/tapestry5/annotations/QueryParameter.html}QueryParameter}} annotation for parameters to event handler methods.
 
   * Submit components can now be used to cancel a form (bypassing client-side validation).

Added: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt?rev=922147&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt (added)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt Fri Mar 12 05:21:19 2010
@@ -0,0 +1,53 @@
+ ----
+ Service Implementation Reloading
+ ----
+ 
+Service Implementation Reloading
+
+  Tapestry's ability to live reload page and component classes is a huge boon to development productivity, but what about reloading services?
+  
+  On the one hand, a good application design keeps the page and component classes "thin" and moves logic into the services layer, for easier
+  reuse across pages.  On the other hand, services don't auto-reload the way pages do, which makes developing that way less agile.
+  
+  Starting in release 5.2, service implementations now reload.  There's a number of restrictions on this, and a couple of
+  {{{http://en.wikipedia.org/wiki/Leaky_abstraction}leaky abstractions}}, but on the whole its quite servicable.
+  
+  You can change your service implementation, and Tapestry picks up the change immediately.
+  
+Limitations
+
+  * Reloading only works for services, and only for services with the default service scope (i.e., global singletons).  Live reloading
+    does not apply to <modules>, <service interfaces>, contributions, or anything but just the service implementation.
+  
+  * Reloading is limited to proxyable services: services with an interface and an implementation of that interface.
+  
+  * Reloading requires that the underlying class files be simple, local, filesystem files (not, for example, files inside a JAR).
+  
+  * Services that do not allow decorations (via the {{{../apidocs/org/apache/tapestry5/ioc/annotations/PreventServiceDecoration.html}PreventServiceDecoration}} annotation) will also
+  not enable live class reloading.
+    
+  []
+  
+Class Loader Issues
+
+  Tapestry creates a new class loader for <each service implementation>. When the underlying .class file changes, the class loader
+  is discarded along with the instance, and a new class loader is created.
+  
+  The class loader only loads the service implementation class, and any inner classes for the service implementation.  
+  All other classes are loaded by the standard class loader for the application.
+  
+  Because of how class loaders work, the class will no longer be able to access package private classes and members of other classes
+  in the same package. You may see some odd IllegalAccessErrors and need to change the visibility of package-private classes to be public.
+  
+  The JVM should be able to eventually garbage collect the class loader.  However, if the class publishes itself to some other service (for example,
+  adding itself as a listener to an event published by some other service), then the instance and the garbage collector
+  will be leaked.  <<Be careful about publishing any instances of a reloadable class>>.
+  
+Update Checks
+
+  Update checks are normally driven by tapestry-core, which periodically checks for changed templates, message catalogs, and component classes. Checks 
+  for changed service implementation classes occur at the same time.  
+  
+  In an application that is not driven by the web tier, you will need to periodically invoke the fireCheckForUpdates() method of the
+  {{{../apidocs/org/apache/tapestry5/services/UpdateListenerHub.html}UpdateListenerHub}} service (which was moved from tapestry-core to tapestry-ioc
+  for this purpose).
\ No newline at end of file

Propchange: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/reload.apt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/site.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/site.xml?rev=922147&r1=922146&r2=922147&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/site.xml (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/site.xml Fri Mar 12 05:21:19 2010
@@ -51,6 +51,7 @@
             <item name="Modules" href="module.html"/>
             <item name="Module Autoloading" href="autoload.html"/>
             <item name="Services" href="service.html"/>
+            <item name="Service Reloading" href="reload.html"/>
             <item name="Advisors" href="advice.html"/>
             <item name="Decorators" href="decorator.html"/>
             <item name="Configuration" href="configuration.html"/>