Overwriting class files
I have an app talking to a PLC which runs 24hours a day. Occasionally I need to update a small change to it. If it isn抰 a mission critical update I抦 happy to wait for the next standard restart.Is it OK to compile a new class file over the top of the current running one so it is available for the next restart? Or does Java perform some reloading / paging of the object.
[377 byte] By [
QldKeva] at [2007-10-2 21:54:27]

> I have an app talking to a PLC which runs 24hours a
> day. Occasionally I need to update a small change to
> it. If it isn抰 a mission critical update I抦 happy
> to wait for the next standard restart.Is it OK to
> compile a new class file over the top of the current
> running one so it is available for the next restart?
> Or does Java perform some reloading / paging of the
> object.
I think that's the use of the xml bean mappings of j2ee. But I don't know if the system will even allow you to overwrite a running application.... why not create a batch or shell script to stop it, compile the code, then run it again, at least it'll be fast... :)
Thanks for the feedback.
I can't stop and restart the process easy as it controls a full automated mill. To do a full stop we need to stop the mill from loading and wait for it to empty, (40 mins delay) then compile restart etc. Then we can start loading cane again.
I'll have a look into hot swapping; and may try a test local having an app running for a few days with a newer version of the class overwritten the original to see what happens.
I normally override the classes by compuiling the source while application is still running and it never effected the application if the classes that are overridden have already been laded in the application.
But that migh depend on the JVM that you are using.
I think it is better to use hot swapping. Or you can modify the script or write a loader for the application which copy the classes from the build destination to the runtime classpath just before the execution of the application.
LRMKa at 2007-7-14 1:10:24 >
