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] Some optimizations for ProducerService. #4264

Closed
1 of 2 tasks
Alonexc opened this issue Jul 21, 2023 · 0 comments · Fixed by #4334
Closed
1 of 2 tasks

[Enhancement] Some optimizations for ProducerService. #4264

Alonexc opened this issue Jul 21, 2023 · 0 comments · Fixed by #4334
Labels
enhancement New feature or request good first issue Issues for first-time contributors

Comments

@Alonexc
Copy link
Contributor

Alonexc commented Jul 21, 2023

Search before asking

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

Enhancement Request

image
image
located at:
eventmesh-connectors/eventmesh-connector-openfunction/src/main/java/org/apache/eventmesh/connector/openfunction/service/ProducerService.java
analysis and explanation:
a. and has three main disadvantages:
Additional behavior such as validation cannot be added.
The internal representation is exposed, and cannot be changed afterwards.
Member values are subject to change from anywhere in the code and may not meet the programmer’s assumptions.
By using private attributes and accessor methods (set and get), unauthorized modifications are prevented.
b. InterruptedExceptions should never be ignored in the code, and simply logging the exception counts in this case as "ignoring". The throwing of the InterruptedException clears the interrupted state of the Thread, so if the exception is not handled properly the information that the thread was interrupted will be lost. Instead, InterruptedExceptions should either be rethrown - immediately or after cleaning up the method’s state - or the thread should be re-interrupted by calling Thread.interrupt() even if this is supposed to be a single-threaded application. Any other course of action risks delaying thread shutdown and loses the information that the thread was interrupted - probably without finishing its task.

Describe the solution you'd like

a. Make field non-public and provide accessors if needed.
image
b. Restore interrupted state
image

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@Alonexc Alonexc added the enhancement New feature or request label Jul 21, 2023
@mxsm mxsm added the good first issue Issues for first-time contributors label Jul 21, 2023
847850277 added a commit to 847850277/incubator-eventmesh that referenced this issue Aug 5, 2023
@mxsm mxsm closed this as completed in #4334 Aug 5, 2023
xwm1992 pushed a commit that referenced this issue Aug 10, 2023
…coverage rate (#4340)

* issues #4264 commit

* unit

* issues #4339 unit test coverage

* issues #4339 WebhookProtocolTransportObjectTest fix

* issues #4339 WebhookProtocolTransportObjectTest fix

* issues #4339 WebhookProtocolTransportObjectTest fix

* issues #4339 WebhookProtocolTransportObjectTest fix

* issues #4339 check style

* issues #4339 new instance replace builder.

* issues #4339 WebhookProtocolTransportObjectTest unit test.

* issues #4339 check style.

* issues #4339 check style.

* issues #4339 check style.

* fixed.

* fixed.

* fixed.

* fixed.

* fixed.

* delete java bean unit test.

* fix build error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Issues for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants