You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Richard Hensley (JIRA)" <hi...@jakarta.apache.org> on 2005/05/04 17:58:23 UTC

[jira] Created: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

add destroy-method attribute to the construct element of BuilderFactory
-----------------------------------------------------------------------

         Key: HIVEMIND-116
         URL: http://issues.apache.org/jira/browse/HIVEMIND-116
     Project: HiveMind
        Type: New Feature
  Components: framework  
    Versions: 1.1    
    Reporter: Richard Hensley


In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.

The following is a specification should be a reasonable start.

add a destroy-method attribute to the construct element recognized by BuilderFactory

When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
Discardable.threadDidDiscardService() method.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597502#action_12597502 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

Another one for the group - when attempting to decorate the implementation class & the destroy method does exist but is final, javassist will throw an exception that the a class is being extended, overriding a final method. The check can easily be done, but the question is how to report it - warn the user (i.e log it) or throw an exception?

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568986#action_12568986 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

I have looked at the implementation of this and have approached it the following way:

In the BuilderFactoryLogic (instantiateCoreServiceInstance() method), add a addShutdownHooks(implementationClass)

The addShutdownHooks returns the (possibly) modified class instance, implementing the above.

Looks good in practice - the service models work exactly the same (no change required).

If this sounds like the correct place to add this functionality, I will can ahead and cleanup/add more tests to cover this.


> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597509#action_12597509 ] 

James Carman commented on HIVEMIND-116:
---------------------------------------

Can't you just log the error with the error handler?  Then, the error handler implementation (whether default or strict) can decide what to do.  This is how we handle other stuff like this I believe.

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572067#action_12572067 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

By enhancing the core class, the implementation class will change name - I am currently using a Hivemind utility class to generate this.  However, when debugging calls in the original implementation, the class name used is not very intuitive - I am thinking that the enhanced class should be called something like HMEnanced<OriginalClassName> or <OriginalClassName>$HMEnanced to not confuse users too much.  Any particular thoughts or suggestions?

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12572066#action_12572066 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

By enhancing the core class, the implementation class will change name - I am currently using a Hivemind utility class to generate this.  However, when debugging calls in the original implementation, the class name used is not very intuitive - I am thinking that the enhanced class should be called something like HMEnanced<OriginalClassName> or <OriginalClassName>$HMEnanced to not confuse users too much.  

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597508#action_12597508 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

Well, not necessarily - I can throw an exception, in which case the error handler will deal with it.  But I can also log it (directly) as a warning.

The latter option is required if you are processing a final class (or even an info message at that point) since there is no way you're gonna be able to decorate it at all (have already stumbled on it for some of Hivemind internal classes).  

Get's a little hairy, cause the case is as follows:

1) The user specifies a destroyMethod, say "doShutdown"
2) The class contains (already) a method registryDidShutdown, which is final
3) The class needs to be enhanced (add the RegistryShutdownListener interface) as well as override the registryDidShutdown (in order to call the doShutdown method).

That's when it blows up somewhat ...

I guess an exception would be ok (rather than a warning) in this case ...  Or what do you think?

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597511#action_12597511 ] 

Johan Lindquist commented on HIVEMIND-116:
------------------------------------------

Sure, will go with that.

Thanks for the help.

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "James Carman (JIRA)" <hi...@jakarta.apache.org>.
    [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12597504#action_12597504 ] 

James Carman commented on HIVEMIND-116:
---------------------------------------

I guess that would depend on how the ErrorHandler wants to handle it, correct?  

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Richard Hensley (JIRA)" <hi...@jakarta.apache.org>.
     [ http://issues.apache.org/jira/browse/HIVEMIND-116?page=comments#action_65771 ]
     
Richard Hensley commented on HIVEMIND-116:
------------------------------------------

Knut,

I've done some research on this issue and the following seems to be a reasonable design for this feature.

I think the following would work for RegistryDidShutdown emulation of destroy-method.

Validate that the name destroy-method exists on the service, use "destroyService" as a default when the destroy-method attribute is not supplied.

If the destroy-method exists on the service, enhance the class in the following ways.
- If the core service does not implement the RegistryDidShutdown interface, add it.
- If the core service does not have a registryDidShutdown method, add it.
- Add a call to the "destroy-method" before the rest of the code in the registryDidShutdown method.

I think the following would work for Discardable emulation of destroy-method

If the destroy-method exists on the service, enhance the class in the following ways.
- If the core service does not implement the Discardable interface, add it.
- If the core service does not have a threadDidDiscardService method, add it.
- Add a call to the "destroy-method" before the rest of the code in the threadDidDiscardService method.

Because the ThreadServiceModel documents that the RegistryShutdownListener is not used, and the Pooled and Singleton Service document that Discardable is not used, there should not be any double calling of the destroy method.

What does everybody think?




> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>          Key: HIVEMIND-116
>          URL: http://issues.apache.org/jira/browse/HIVEMIND-116
>      Project: HiveMind
>         Type: New Feature
>   Components: framework
>     Versions: 1.1
>     Reporter: Richard Hensley

>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-dev-help@jakarta.apache.org


[jira] Updated: (HIVEMIND-116) add destroy-method attribute to the construct element of BuilderFactory

Posted by "Johan Lindquist (JIRA)" <hi...@jakarta.apache.org>.
     [ https://issues.apache.org/jira/browse/HIVEMIND-116?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Johan Lindquist updated HIVEMIND-116:
-------------------------------------

    Comment: was deleted

> add destroy-method attribute to the construct element of BuilderFactory
> -----------------------------------------------------------------------
>
>                 Key: HIVEMIND-116
>                 URL: https://issues.apache.org/jira/browse/HIVEMIND-116
>             Project: HiveMind
>          Issue Type: New Feature
>          Components: framework
>    Affects Versions: 1.1
>            Reporter: Richard Hensley
>
> In order to keep object agnostic of container, please add attributes to the BuilderFactory contruct element that support the standard lifecycle management of Hivemind. This request is for the destroy step in the life cycle of a service. This attribute could be used instead of RegistryShutdownListener and Discardable.
> The following is a specification should be a reasonable start.
> add a destroy-method attribute to the construct element recognized by BuilderFactory
> When the destroy-method is specified, the method must be a public void method taking no parameters. This method is called when the registry is shutdown for primitive, singleton, and pooled services. This method is
> called when the thread is cleaned up for a threaded service. When autowire-service is enabled and destroy-method is not specified, BuilderFactory will introspect for a method called destroyService() and
> treat it as a destroy-method. In the case of singleton and pooled services, if the service implements the RegistryShutdownListener, the destroy-method is called before the RegistryShutdownListener.registryDidShutdown() method. In the case of threaded services, if the service implements the Discardable interface, the destroy-method is called before the
> Discardable.threadDidDiscardService() method.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.