←Older revision |
Revision as of 07:57, 18 February 2011 |
Line 5: |
Line 5: |
| == [[Hotswap]] is not Only About Changing Classes == | | == [[Hotswap]] is not Only About Changing Classes == |
| | | |
- | My ode to ''true'' [[hotswap]] contained one important observation: ''Now it is easier to change any class in my program than to modify content of Bundle.properties!'' As [[Javeleon]] author Allan Gregersen convinced me - having the ability to update classes, is just first step, there is much more that needs to be done to make the [[hotswap]] ''real''. | + | My ode to ''true'' [[hotswap]] contained one important observation: ''Now it is easier to change any class in my program than to modify content of Bundle.properties!'' As [[Javeleon]] author Allan Gregersen convinced me - having the ability to update classes, is just the first step. There is much more that needs to be done to make the [[hotswap]] ''real''. |
| | | |
| === Resources === | | === Resources === |
| | | |
- | As already noted, resources often need to be updated too. Otherwise you may get new version of a class trying to access ''ResourceBundle.getString'' for a key which is not in the outdated version of the bundle. To support reloading of resources, one needs to enhance existing ''ClassLoader''s a bit. | + | As already noted, resources often need to be updated too. Otherwise you may get new version of a class trying to access ''ResourceBundle.getString'' for a key which is not yet in the outdated version of the bundle. To support reloading of resources, one needs to enhance existing ''ClassLoader''s a bit. |
| | | |
- | There is no reason for new [[API]]s on [[Java]] side. When the [[JDK]] [[Hotswap]] implemented by [[Thomas Würthinger]] is available, you can always tweak all the existing classes (''ResourceBundle'', ''ClassLoader'', or [[NetBeans]] ''StandardModule'', etc.) and [[hotswap]] them with a new version that is capable to support the generic updating platform. | + | There is no reason for new [[API]]s on [[Java]] side as soon as the [[JDK]] [[Hotswap]] implemented by [[Thomas Würthinger]] is available. Then the system can always tweak all the existing classes (''ResourceBundle'', ''ClassLoader'', or [[NetBeans]] ''StandardModule'', etc.) and [[hotswap]] them with a new version that is capable to support ''real'' [[hotswap]] of any custom code and resources. |
| | | |
- | Of course, being able to hotswap existing classes like ''ResourceBundle'', creates some form of close [[API]]-like dependency between the [[JDK]] team and the provider of a real [[Hotswap]] platform. This kind of [[API]] is also very fragile and can often break (unless the contract is stiffed by using [[Amoeba]] techniques) and requires intimate knowledge of the internals of various pieces of [[JDK]] or [[NetBeans]]. | + | Of course, being able to hotswap existing classes like ''ResourceBundle'', creates some form of close [[API]]-like dependency between the [[JDK]] team and the provider of a real [[Hotswap]] platform. This kind of binary patching [[API]] is very fragile and can often break (unless the contract is stiffed by using [[Amoeba]] techniques) and requires intimate knowledge of the internals of various pieces of [[JDK]] or [[NetBeans]]. |
| | | |
- | Still things can work. If there is a need for [[hotswap]], one "bootstraps" by hotswapping important [[JDK]] and framework classes first. Then one can start updating the user artifacts as freely as necessary. Only the sky will be the limit. | + | Still things can work. If there is a need for [[hotswap]], one ''bootstraps'' by [[hotswap]]ping important [[JDK]] and framework classes first. Then one can start updating the user artifacts as freely as necessary. Only the sky becomes the limit. |
| | | |
| === Caches === | | === Caches === |
Line 21: |
Line 21: |
| Caches are another thing that needs attention. The above mentioned ''ResourceBundle'' not only needs to learn about new .properties file being available, but it also needs to clean the previously loaded values from internal caches. Provider of real [[hotswap]]ping solution needs to be aware of caches like this and needs to invalidate them when necessary. | | Caches are another thing that needs attention. The above mentioned ''ResourceBundle'' not only needs to learn about new .properties file being available, but it also needs to clean the previously loaded values from internal caches. Provider of real [[hotswap]]ping solution needs to be aware of caches like this and needs to invalidate them when necessary. |
| | | |
- | Getting this work correctly is tricky. [[Javeleon]] does this fine job for [[NetBeans]] Platform based applications. | + | Getting this work correctly is tricky. [[Javeleon]] comes with bunch of hooks like this for [[NetBeans]] Platform based applications. |
| | | |
| === Adding new classes === | | === Adding new classes === |
| | | |
- | Reloading existing class (as handled by Thomas [[Hotswap]]) is easier than adding new classes. There is many classloaders in typical [[Modular system]]s. When declaring new class, one shall tell the [[JVM]] which classloader shall load it. The [[JPDA]] [[API]] is not capable of doing this right now. | + | Reloading existing class (as handled by Thomas's [[Hotswap]]) is easier than adding new classes. There are many classloaders in typical [[Modular system]]s. When declaring new class, one shall tell the [[JVM]] which classloader shall load it. The [[JPDA]] [[API]] is not capable of doing this right now. |
| | | |
| Still, we can use the trick with [[hotswap]]ping the core [[JDK]] classes and updating them with such possibility. Just load in an enhanced version of ''ClassLoader'' and use the newly defined private contract to tell it about the availability of a new class. | | Still, we can use the trick with [[hotswap]]ping the core [[JDK]] classes and updating them with such possibility. Just load in an enhanced version of ''ClassLoader'' and use the newly defined private contract to tell it about the availability of a new class. |