changes to ComponentHelper.sfShouldDetachOrTerminate()

Steve Loughran <[email protected]> Thu, 21 Sep 2006 11:59:53 +0100
Newsgroups gmane.comp.java.smartfrog.devel
Message-ID <[email protected]>
if you dont use or plan to use 
ComponentHelper.sfShouldDetachOrTerminate(), then skip this message.

if you do use it, know that I've been editing the code to make it more 
readable, and, I think, getting its semantics consistent with what was 
intended.


If you use it on any component after it has started (or in a helper 
thread, after all work has done), then it decides whether or not to 
terminate or detach the component based on three attributes

sfShouldTerminate - should we terminate the component (default, false)
sfShouldTerminateQuietly - should we terminate the component quietly 
(default, false)
sfShouldDetach - should we detach the component

Here is the policy I've implemented
-if either sfShouldTerminate or sfShouldTerminateQuietly is true, we 
terminate
-if sfShouldTerminateQuietly is true, then we terminate quietly, 
regardless of the value of sfShouldTerminate
-if sfShouldDetach is true then the component is detached. This happens 
even if the component doesnt want to terminate
-If none of the attributes are set, or all are false then nothing happens.

The effect is that by adding a call to new 
ComponentHelper(this).sfShouldDetachOrTerminate(...) at the end of 
sfStart() -or at the end of any thread that does startup work, your 
component slots straight into the workflow components, as it can be told 
to terminate or detach after deployment. It will also slot into the 
testing components that I am currently writing into sfServices, as these 
will use sequences for assertions and finally {} operations.

I'm retrofitting the operation to components that make sense to embed 
into workflow stuff. We already use it at some of the file and java 
components, but it is not as ubiquitous as it ought to be for effective 
workflow sequences -not enough things terminate after starting.

-steve




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV