-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(all):tune the sequence of resources closure #5447
feat(all):tune the sequence of resources closure #5447
Conversation
6c1fa19
to
dc8e0bc
Compare
1a1a56a
to
9fca4fc
Compare
https://tronscan.org/#/transaction/d7588a4a89bd03b2cfb91141ef312c2b0cdb59f4624f20a0ac6d5c8b8c421be6 |
public class ZksnarkInitService { | ||
|
||
static { | ||
librustzcashInitZksnarkParams(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is this method called? The original logic was to call it when the HTTP service is enabled. What would happen if this method is called when the HTTP service is not enabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For shielded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better also require the code author to review this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if this method is called when the HTTP service is not enabled?
Prepare to use @DependsOn("fullNodeHttpApiService")
to keep the original logic, current guess is delayed initialization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Federico2014 PTAL.
|
import lombok.extern.slf4j.Slf4j; | ||
import org.tron.common.parameter.CommonParameter; | ||
|
||
@Slf4j(topic = "app") | ||
public class ServiceContainer { | ||
|
||
private ArrayList<Service> services; | ||
private final Set<Service> services; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the purpose of changing List to Set, if two objects execute init()
with the same class and port but without executing start()
, they will be equal according to the above modification?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, block duplicate service.
} | ||
|
||
@Override | ||
public void startServices() { | ||
services.start(); | ||
} | ||
|
||
@Override | ||
// DO NOT USE THIS METHOD IN TEST CASES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this comment below the Override
?
} | ||
|
||
public void blockUntilShutdown() { | ||
this.services.stream().findFirst().ifPresent(Service::blockUntilShutdown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only check the first service is stopped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blockUntilShutdown
synchronously blocks the current thread, usually the main thread
.
@@ -25,7 +25,6 @@ public TronApplicationContext(String... basePackages) { | |||
public void doClose() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I see, all singletons' close logic was delivered to Spring, is there any dependency between them, or may occur any exceptions when the close order was not as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The bean dependencies are managed by spring, and initialization and destroy are in reverse order.
9fca4fc
to
da66ab8
Compare
No needed. |
fix panicked librustzcash/src/rustzcash.rs:925:9
bb83449
to
fc95152
Compare
|
close #5433