Steve Brewin wrote:
Noel,

A few days back we touched on the desirability of being able to reconfigure
James on the fly. ...

It seems to me dynamic reconfiguration can be achieved with fairly run-of-the-mill Java, without needing Avalon, XML, or JMX.

To demonstrate this to myself and to anyone else who may be interested, I have written a demonstration, the source code of which you may find in the attached zip file.

The demonstration uses a Server which runs a ServerScript again and again in a loop. A ServerScript consists of a list of tasks which implement MMPair (general purpose classes meant to mimic Mailet/Matcher pairs). The Server prints reports of its cycles in a JFrame, and the tasks print little reports there too.

The ServerScript can be updated dynamically by the Manager, which runs with Standard.in and Standard.out. While the Server is running you can copy new instances of MMPair into the dynamicconfiguration directory (where my classloader can find them) and add these MMPair(s) to the ServerScript with the "new" command in the Manager. You can also drop MMPair(s) from the ServerScript with the drop command in the Manager.

I do not claim this code is robust. It only demonstrates a possibility. The manager makes no attempt to validate its input; an input error makes it halt with an error message. Synchronization of access to the ServerScript has not been addressed in this demo, and it can break with concurrent access.

If you run this demonstration, keep in mind that the ServerScript is an ArrayList which is empty until you add tasks from the Manager. The indexes which you give to the commands [add | new | drop] must be in the range of the present ArrayList. For instance the first addition must be at 0, and so on.

Rich Hammer
Hillsborough, N.C.

Attachment: DC.zip
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to