<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Deployment</title><link>https://sourceforge.net/p/rupy/wiki/Deployment/</link><description>Recent changes to Deployment</description><atom:link href="https://sourceforge.net/p/rupy/wiki/Deployment/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 13 Mar 2015 09:59:57 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/rupy/wiki/Deployment/feed" rel="self" type="application/rss+xml"/><item><title>Deployment modified by Anonymous</title><link>https://sourceforge.net/p/rupy/wiki/Deployment/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;The classloader in rupy is very simplistic, so you have to be careful how you write your hot-deployable code and what you store in the session. We recommend that you don't store hot-deployed classes with the &lt;code&gt;Session.put(key, value)&lt;/code&gt; method, since &lt;code&gt;Session.get(key)&lt;/code&gt; will throw a &lt;code&gt;ClassCastException&lt;/code&gt; if you hot-deploy your application. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Think Small&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We store a &lt;em&gt;String&lt;/em&gt; value, for example: &lt;code&gt;Session.put("key", "XT4E")&lt;/code&gt; that maps to the actual data object in a hashmap. Because &lt;em&gt;String&lt;/em&gt; is a bootclasspath class, old sessions can keep running the old code while new sessions run the new code without classloading issues. The user experience of a hot-deployment becomes seamless. &lt;/p&gt;
&lt;p&gt;Another positive side-effect of limitations in Rupy is the lack of hot-deployed libs; since we only hot-deploy the application code, and libs are added to the bootclasspath, your server runs out of memory later rather than sooner during development. This is also true for the live environment of course. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Common Solutions&lt;/strong&gt; (in order of popularity) &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure the hot-deployed classes are not in the bootclasspath. &lt;/li&gt;
&lt;li&gt;Don't try to load a hot-deployed class with &lt;code&gt;Class.forName(String)&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;All classes have to have a void attribute constructor. &lt;/li&gt;
&lt;li&gt;Inner classes need to be public static. &lt;/li&gt;
&lt;li&gt;Implemented interfaces in the bootclasspath need to be public, even if the hot-deployed implementing class is in the same package. &lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Don't instantiate the class statically inside itself. &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;public&lt;/span&gt; &lt;span class="n"&gt;class&lt;/span&gt; &lt;span class="n"&gt;Lock&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="n"&gt;Lock&lt;/span&gt; &lt;span class="n"&gt;lock&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Deploy static resource bundles az &lt;strong&gt;.zip&lt;/strong&gt; instead of &lt;strong&gt;.jar&lt;/strong&gt; to avoid them being copied at server restart. &lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Anonymous</dc:creator><pubDate>Fri, 13 Mar 2015 09:59:57 -0000</pubDate><guid>https://sourceforge.net49c46c71264168dd3a9d62341d55fe45562ca438</guid></item></channel></rss>