I have written a server application but I want to be able to edit the server’s configuration while it is running and reload it into the server’s memory without restarting, is there any way to do this in java other than creating a listening socket for configuration purposes?
Share
In the library Apache Commons IO, you get for free a
File monitorwhich you can use to know if a configuration file has been modified and handle the modificationIn Java 7, you have a similar functionality in NIO2, a
WatchServiceI think.After that, correctly handling the modification depends on your architecture. You may have a look at
ClassLoaderto discard certain part of your configuration and load others