Return-Path: Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 34756 invoked from network); 30 Sep 2003 11:27:27 -0000 Received: from unknown (HELO smtp018.mail.yahoo.com) (216.136.174.115) by daedalus.apache.org with SMTP; 30 Sep 2003 11:27:27 -0000 Received: from suedu3-202-235.utaonline.at (HELO MEDION1) (christianessl@212.152.202.235 with login) by smtp.mail.vip.sc5.yahoo.com with SMTP; 30 Sep 2003 11:27:27 -0000 Content-Type: text/plain; charset=iso-8859-15; format=flowed To: "commons-dev@jakarta.apache.org" Subject: [HiveMind] New service-model hot-replace/shut-down From: Christian Essl MIME-Version: 1.0 Date: Tue, 30 Sep 2003 13:28:14 +0200 Message-ID: User-Agent: Opera7.11/Win32 M2 build 2887 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N I'd like to suggest a new service-model, which allows to replace and/or shut-down a service-implementation at runtime. (The latest refactoring makes this much easier). The model works basicly like the deferred-model (except that it always returns the proxy). Initially it is in the deferred state and when the first request comes it creates the implementation. Different to the deffere-model all metods are sychronized with a acquireRead() read on a read-write-lock (reads go unsychnorinzed until some one aquires the write). When the user wants to shutdown or replace the implementation, the ServiceExtensionPoint aquires the write-lock. Now all current service- method-calls can finish and furthers are blocked. Than the proxy just switches back to the deffered state and does the clean-up on the service- implementation. In case of hot-replace the ServiceExtensionPoint also replaces the ServiceImplementationConstructor. Than the write-lock is released and if a new call comes in the (new)implementation is created again. I would say the management could happen through a special service at which all the hot-replace extension points register. I think this allows shut-down and replace during run-time and that it is totally transparent to the whole application. I'm quite sure there are also no threading issues. As I see the only dissadvantage is that it slows down the service a bit. It could be useful for testing and ie togehter with a timer for services which are rearly used but consume quite a lot of resources. If there is any intrest I could try to implement such a service-model.