Reload java extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

ffratoni
Posts: 10
Joined: 15 Sep 2008, 13:45

extension classloaders

Post by ffratoni »

Hi all,
following this discussion I've found a solution to the hot reload of an extension. But I fall down in a new problem. I've two extensions that share spring application context in a singleton and everything was working well if deployed in a single jar_with_dependencies and loaded via standard classloader during smartfox bootstrap, but with such kind of deploy was impossible the hot reload. Now with the new deploy in the javaExtension directory the singleton is initialized twice. Looks like is not recognized as the same type by the application. Which is the strategy you are using to load extension classes ? Are you using different classloaders?
Filippo
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Yes we do
Lapo
--
gotoAndPlay()
...addicted to flash games
ffratoni
Posts: 10
Joined: 15 Sep 2008, 13:45

coclusion

Post by ffratoni »

Ok so:
if I deploy in a single jar I can create a singleton with application scope
If I deploy classes in the javaExtensions directori and I remove that directory from the classpath how can I implement the singleton pattern? Is there any good practice? Should I maintain the spring context only in one extension and then use the handleRequestInternalMethod to use spring managed beans?
Thanks in advance
Filippo
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

Unfortunately have little to no experience with Spring so I don't think I can be of much help in this area.
About the singleton thing, if that is the problem, why would you need one?
The extension is one java class (at least its entry point). Can't you pass a reference of it to the other objects used by the server side logic?

This way you don't use static data and when you issue an extension reload you shouldn't have problems.
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply