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

[Enhancement] EventMeshServer subcomponent lifecycle management #4781

Open
2 of 3 tasks
Ish1yu opened this issue Feb 29, 2024 · 5 comments · May be fixed by #4783
Open
2 of 3 tasks

[Enhancement] EventMeshServer subcomponent lifecycle management #4781

Ish1yu opened this issue Feb 29, 2024 · 5 comments · May be fixed by #4783
Labels
enhancement New feature or request Stale

Comments

@Ish1yu
Copy link
Contributor

Ish1yu commented Feb 29, 2024

Search before asking

  • I had searched in the issues and found no similar issues.

Enhancement Request

I have seen multiple properties of EventMeshServer, such as Acl or MetaStorage, which are actually wrappers for declaring the cycle state of specific services. There are several properties that indicate the current state, such as initialized, started, etc. There are also methods for state transition, such as # init. So, I wonder if it's possible to change these classes to LifeCircle form for management, At that time, there will be a superclass such as AbstractEventMeshInitializerLifeCircle, which implements management of properties such as initiate and calls to # init. Therefore, EventMeshServer only needs to maintain one

我感觉英文有点词不达意
我看到 EventMeshServer 的多个属性,如 Acl 或 MetaStorage 等,其实都是对于具体服务附加声明周期状态的包装,会有几个标志当前状态的属性,如 inited、started等,还有有状态转换的方法如 #init 等,那我想可以不可以把这些类都改成 LifeCircle 形式管理,到时候会有一个比如AbstractEventMeshInitalizerLifeCircle 之类的超类,实现了对于inited等属性等管理和对#init的调用,那么 EventMeshServer 只需要维护一个 LifeCircleList 就可以管理这些对象了

Describe the solution you'd like

`

public abstract class AbstractDemoLifeCircle {

private final AtomicBoolean inited = new AtomicBoolean(false);

private final AtomicBoolean started = new AtomicBoolean(false);

private final AtomicBoolean shutdown = new AtomicBoolean(false);


public void init() throws Exception {
    if (!inited.compareAndSet(false, true)) {
        return;
    }
    componentInit();
}

abstract void componentInit();

public void start() throws Exception {
    if (!started.compareAndSet(false, true)) {
        return;
    }
    componentStart();
}
abstract void componentStart();
public void shutdown() throws AclException {
    inited.compareAndSet(true, false);
    started.compareAndSet(true, false);
    if (!shutdown.compareAndSet(false, true)) {
        return;
    }
    componentStop();
}
abstract void componentStop();

}

`

`

public class Acl extends AbstractDemoLifeCircle {}

`

`

public class EventMeshServer {
...
private List components;
...
public void init() throws Exception {
components.forEach(component -> component .init());
}

}

`

As for the special handling of EventMeshBootstrap, it is completely possible to wait for init before executing the original logic
至于 EventMeshBootstrap 这种特殊处理,完全可以等init之后再执行原逻辑

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Ish1yu Ish1yu added the enhancement New feature or request label Feb 29, 2024
Copy link
Contributor

Welcome to the Apache EventMesh community!!
We are glad that you are contributing by opening this issue. :D

Please make sure to include all the relevant context.
We will be here shortly.

If you are interested in contributing to our project, please let us know!
You can check out our contributing guide on contributing to EventMesh.

Want to get closer to the community?

WeChat Assistant WeChat Public Account Slack
Join Slack Chat

Mailing Lists:

Name Description Subscribe Unsubscribe Archive
Users User support and questions mailing list Subscribe Unsubscribe Mail Archives
Development Development related discussions Subscribe Unsubscribe Mail Archives
Commits All commits to repositories Subscribe Unsubscribe Mail Archives
Issues Issues or PRs comments and reviews Subscribe Unsubscribe Mail Archives

@Pil0tXia
Copy link
Member

Pil0tXia commented Feb 29, 2024

The code block seems to be broken.

image

@Ish1yu
Copy link
Contributor Author

Ish1yu commented Feb 29, 2024

1709207265696 1709207469668 1709207723778 1709207797944

@Ish1yu
Copy link
Contributor Author

Ish1yu commented Mar 1, 2024

@Pil0tXia im build a demo pr later

@Ish1yu Ish1yu changed the title [Enhancement] EventMeshServer property management [Enhancement] EventMeshServer subcomponent lifecycle management Mar 11, 2024
Copy link
Contributor

github-actions bot commented Jun 9, 2024

It has been 90 days since the last activity on this issue. Apache EventMesh values the voices of the community. Please don't hesitate to share your latest insights on this matter at any time, as the community is more than willing to engage in discussions regarding the development and optimization directions of this feature.

If you feel that your issue has been resolved, please feel free to close it. Should you have any additional information to share, you are welcome to reopen this issue.

@github-actions github-actions bot added the Stale label Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants