Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports life cycle callbacks for user processor #123

Closed
killme2008 opened this issue Dec 26, 2018 · 3 comments · Fixed by #229
Closed

Supports life cycle callbacks for user processor #123

killme2008 opened this issue Dec 26, 2018 · 3 comments · Fixed by #229
Assignees
Labels
dev:feature New feature or request
Milestone

Comments

@killme2008
Copy link

Is your feature request related to a problem? Please describe.

User processors may have some resources when processing requests, such as file, database conenction etc.

But current user processors doesn't have life cycle mechanism, we can't initialize or destroy resources explictly.

Describe the solution you'd like

UserProcessor adds callback methods:

// Initialize the user processor
public void init();
//Destroy the user processor.
public void destroy();

And the framework will call these callback methods in start or shutdown. These new methods should have default implementations by using java8' s default method.

@fengjiachun
Copy link

Another way is to check whether the user processor implements the interface 'Lifecycle'. If so, execute the init / destroy method?

@dbl-x dbl-x self-assigned this Jan 3, 2019
@dbl-x dbl-x added this to the 1.6.0 release milestone Jan 3, 2019
@dbl-x
Copy link
Contributor

dbl-x commented Jan 3, 2019

这个可能会在1.6的版本中去支持,原1.6的开发计划已经包含了统一生命周期的接口。
接口统一后再考虑UserProcessor增加生命周期的能力。
另外是否基于1.8提供default实现这个要考虑当前使用的情况,也许需要兼容当前1.6的方式,提供默认实现,用户有需要时进行覆盖。

@dbl-x
Copy link
Contributor

dbl-x commented Jan 3, 2019

附1.6开发计划:https://github.com/alipay/sofa-bolt/wiki/Bolt-1.6.0%E5%BC%80%E5%8F%91%E8%AE%A1%E5%88%92

@dbl-x dbl-x added the dev:feature New feature or request label Mar 21, 2019
@cytnju cytnju modified the milestones: 1.6.0 release, 1.6.1 release Nov 29, 2019
dbl-x pushed a commit that referenced this issue Dec 12, 2019
* support availability check with life cycle. #123(#123)

* complete unit test of life cycle available check
dbl-x pushed a commit that referenced this issue Dec 12, 2019
* support user processor with life cycle interface

* make sure user processor startup if client/server has startup

* add state check before operate user processor in order to prevent from some unnecessary exception
@cytnju cytnju closed this as completed Dec 12, 2019
dbl-x pushed a commit that referenced this issue Dec 16, 2019
* (feat) add flush consolidation handler (#161)

* (feat) add flush consolidation option

* 1. upgrade version to 1.5.6 (#169)

2. fix NPE in channelInactive
3. handling reconnection situation with no connection binding with channel
4. du not scan connection pool associated with task that has not been don
5. add CONNECT_FAILED event type and print user event log

* Change org from alipay to sofatack. (#172)

* Update .travis.yml (#177)

* modify ReconnectManager to be compatible with version 1.5.x

* upgrade netty version to fix CNNVD-201909-1264 vulnerability (#189)

* 应该一个是序列化一个是反序列化 (#191)

fix unit test bug in class NormalStringCustomSerializer.

* (feat) Supports SSL for rpc server/client, #149 (#197)

* support server random port constructor. fix #196 (#199)

* fix AbstractLifeCycle concurrency problem Fixes gh-163 (#188)

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.

* support server random port constructor

* add rejection-processable InvokeCallback to provide flexible options when user executor rejected task. see #178(#178) (#202)

* complete tcp related config. see #171(#171) (#205)

* optimize DefaultConnectionManager contructor (#201)

* support availability check with life cycle. #195 (#204)

* support availability check with life cycle. #123(#123)

* complete unit test of life cycle available check

* fix CI error

* Fix/multi processor bug (#207)

* fix spell mistake and some test codes (#194)

* fix multi-processor bug

* fix PMD

* support user processor with life cycle interface fix #123 (#200)

* support user processor with life cycle interface

* make sure user processor startup if client/server has startup

* add state check before operate user processor in order to prevent from some unnecessary exception

* fix some codes (#208)

* change version
cytnju added a commit that referenced this issue Jul 6, 2020
* release 1.6.1 (#209)

* (feat) add flush consolidation handler (#161)

* (feat) add flush consolidation option

* 1. upgrade version to 1.5.6 (#169)

2. fix NPE in channelInactive
3. handling reconnection situation with no connection binding with channel
4. du not scan connection pool associated with task that has not been don
5. add CONNECT_FAILED event type and print user event log

* Change org from alipay to sofatack. (#172)

* Update .travis.yml (#177)

* modify ReconnectManager to be compatible with version 1.5.x

* upgrade netty version to fix CNNVD-201909-1264 vulnerability (#189)

* 应该一个是序列化一个是反序列化 (#191)

fix unit test bug in class NormalStringCustomSerializer.

* (feat) Supports SSL for rpc server/client, #149 (#197)

* support server random port constructor. fix #196 (#199)

* fix AbstractLifeCycle concurrency problem Fixes gh-163 (#188)

* fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157

* Revert "fix  AsynMultiInterestUserProcessor dispatch to sync handleRequest  method problem. gh-157"

This reverts commit 2784f9e.

* support server random port constructor

* add rejection-processable InvokeCallback to provide flexible options when user executor rejected task. see #178(#178) (#202)

* complete tcp related config. see #171(#171) (#205)

* optimize DefaultConnectionManager contructor (#201)

* support availability check with life cycle. #195 (#204)

* support availability check with life cycle. #123(#123)

* complete unit test of life cycle available check

* fix CI error

* Fix/multi processor bug (#207)

* fix spell mistake and some test codes (#194)

* fix multi-processor bug

* fix PMD

* support user processor with life cycle interface fix #123 (#200)

* support user processor with life cycle interface

* make sure user processor startup if client/server has startup

* add state check before operate user processor in order to prevent from some unnecessary exception

* fix some codes (#208)

* change version

* update travis ci config

Co-authored-by: cytnju <muyun.cyt@antfin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev:feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants