You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Pereslegin (Jira)" <ji...@apache.org> on 2021/10/22 11:57:00 UTC

[jira] [Updated] (IGNITE-15801) Annotation-based injection of ServiceContext in Ignite services.

     [ https://issues.apache.org/jira/browse/IGNITE-15801?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Pereslegin updated IGNITE-15801:
--------------------------------------
    Description: 
Inject ServiceContext using special annotation.

Suggested approach for Java services:

_1. Add init/execute/cancel methods without parameters._
 _2. Add default no-op implementations for the new methods (this is required_
 _to preserve compatibility)._
 _3. For old methods that take ServiceContext as a parameter, add default_
 _implementations that delegate to new methods._
 _4. Deprecate the old methods on the API._
 _5. On the implementation level, still use the old methods (again - for_
 _compatibility)._
 _6. Finally, add a @ServiceContextResource annotation to inject_
 _ServiceContext._

Pros:
 1. The annotation-based injection is a user-friendly approach widely used in Ignite.
 2. The user does not need to implement all the lifecycle methods every time.

Cons:
1. Duplication of methods in the Service interface for an indefinite period.
2. Someday we need to remove the old methods, and this will break all ignite services that use the old approach.

  was:
Inject ServiceContext using special annotation.

Suggested approach for Java services:

_1. Add init/execute/cancel methods without parameters._
_2. Add default no-op implementations for the new methods (this is required_
_to preserve compatibility)._
_3. For old methods that take ServiceContext as a parameter, add default_
_implementations that delegate to new methods._
_4. Deprecate the old methods on the API._
_5. On the implementation level, still use the old methods (again - for_
_compatibility)._
_6. Finally, add a @ServiceContextResource annotation to inject_
_ServiceContext._

Pros:
1. The annotation-based injection is a user-friendly approach widely used in Ignite.
2. The user does not need to implement all the lifecycle methods every time.


> Annotation-based injection of ServiceContext in Ignite services.
> ----------------------------------------------------------------
>
>                 Key: IGNITE-15801
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15801
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Pavel Pereslegin
>            Priority: Major
>
> Inject ServiceContext using special annotation.
> Suggested approach for Java services:
> _1. Add init/execute/cancel methods without parameters._
>  _2. Add default no-op implementations for the new methods (this is required_
>  _to preserve compatibility)._
>  _3. For old methods that take ServiceContext as a parameter, add default_
>  _implementations that delegate to new methods._
>  _4. Deprecate the old methods on the API._
>  _5. On the implementation level, still use the old methods (again - for_
>  _compatibility)._
>  _6. Finally, add a @ServiceContextResource annotation to inject_
>  _ServiceContext._
> Pros:
>  1. The annotation-based injection is a user-friendly approach widely used in Ignite.
>  2. The user does not need to implement all the lifecycle methods every time.
> Cons:
> 1. Duplication of methods in the Service interface for an indefinite period.
> 2. Someday we need to remove the old methods, and this will break all ignite services that use the old approach.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)