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

Add Lifecycle hooks #54

Open
pith opened this issue Feb 1, 2016 · 4 comments
Open

Add Lifecycle hooks #54

pith opened this issue Feb 1, 2016 · 4 comments

Comments

@pith
Copy link
Member

pith commented Feb 1, 2016

Currently start() and stop() methods comes from the Plugin interface. It can be a good idea to move then to a new Lifecycle interface. The AbstractPlugin should extends this new interface for compatibility.

It will allow application developers to easily start/stop resources without creating a Plugin. Lifecycle implementations can be scanned during the init phase so there will be no need for ServiceLoader here.

@pith pith added this to the 1.0 milestone Feb 1, 2016
@ejemba
Copy link
Member

ejemba commented Feb 1, 2016

I think it is a good idea !
Let us think what can be the downside of this.
Why do not create a plugin that will do this exact thing ?
Will the Resource be injected ? or Injectable ? both ?
I imagine having this can be great.
Does plugin and resource really need to share this interface ?

@pith
Copy link
Member Author

pith commented Feb 2, 2016

Yes they should be injectable. Exactly like plugins currently.

And Yes, I think it should be the same interface. It's frequent that plugins don't implement lifecycle methods. So I think these methods could be extracted as a separate concern.

The kernel will start/stop all the Lifecycle implementations whether they are plugins or not. And not all the plugins have to implements Lifecycle.

@ejemba
Copy link
Member

ejemba commented Feb 2, 2016

@pith you're right. This is a must for the 1.0 milestone.

I wonder If we might or not fullfill the JSR 250 which purpose is Resource Management.
https://en.wikipedia.org/wiki/JSR_250

We have to be carefull that when we scan for Lifecycle we do not reach plugin themselves.

@ejemba
Copy link
Member

ejemba commented Feb 2, 2016

I think the JSR 250 is also a must have but in another issue.
Adding jsr250 annotations on injected pojo might also be a good addition to the kernel.
I create the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants