Is it possible to hotswap external libraries?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Aet
Posts: 34
Joined: 15 Aug 2019, 23:10

Is it possible to hotswap external libraries?

Postby Aet » 03 Mar 2021, 23:49

I want to make a change to our zone extension for our Smartfox server that adds a couple additional external libraries.

I wanted to check if it is possible to hotswap the extension with adding the new libraries to the /lib/ folder and replacing the extension jar then reloading, or if this always requires a server restart? We have had issues with this in the past trying to avoid the hard restart on our users.

If it always requires a server restart then what are the downsides of building the external jar's into our extension jar to avoid this?

Thanks for the help!
User avatar
Lapo
Site Admin
Posts: 23009
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Is it possible to hotswap external libraries?

Postby Lapo » 04 Mar 2021, 07:51

Hi,
no it's not possible, because the dependencies in the main classpath are loaded once, at server startup.

If it always requires a server restart then what are the downsides of building the external jar's into our extension jar to avoid this?

If the Extension runs at Zone level there aren't significant downsides, besides load/reload times.
However if the Extension is supposed to work at Room level bundling the dependencies into the Extension's jar means that every Room will instantiate a copy of the Extension and relative dependencies.

We don't recommend this approach for Room level Extensions as it can hit the JVM memory hard and it's difficult to optimize. Exceptions can be made if the included libraries have a small size (50-100K) and are low in number.

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
Aet
Posts: 34
Joined: 15 Aug 2019, 23:10

Re: Is it possible to hotswap external libraries?

Postby Aet » 04 Mar 2021, 08:10

Thanks! Exactly the answer we needed.

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 52 guests