<- Serialization of Shared Data Contents PowerForms - Declarative Form Input Validation ->

Updating a Running Service

The jwig tool has special support for updating running services. This is a nontrivial task for several reasons:

The command

      jwig update dir files

ensures that the service files are updated atomically and only at well-defined places in the thread execution. The arguments are as for the jwig install command.

Before the update is performed, the tool checks the serialVersionUID for each Serializable class in the service. If this number have changed for one or more files, the update is aborted to avoid unserialization errors and corruption of the service state. See Sun's serialization guide for a description of using serialization with evolution.

The update is performed as follows: First, the service directory is locked (using jvm.lock) such that new requests to start service threads are blocked ("503 Service Unavailable") Then, the tool waits until there are no running threads, that is, they are all either terminated or waiting for client response. All waiting threads are then terminated. (This should give a well-defined behavior since clients may never respond anyway; the clients that run these threads are met with a "session has terminated" error). The files are then copied to the service directory, overwriting the existing files. Finally, the service lock is removed to accept new requests.


<- Serialization of Shared Data Contents PowerForms - Declarative Form Input Validation ->