Copilot commented on code in PR #15602:
URL: https://github.com/apache/dubbo/pull/15602#discussion_r2246756644
##########
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/pu/AbstractPortUnificationServer.java:
##########
@@ -44,14 +44,14 @@ public abstract class AbstractPortUnificationServer extends
AbstractServer {
protocol name --> URL object
wire protocol will get url object to config server pipeline for channel
*/
- private final Map<String, URL> supportedUrls = new ConcurrentHashMap<>();
+ private Map<String, URL> supportedUrls = new ConcurrentHashMap<>();
/*
protocol name --> ChannelHandler object
wire protocol will get handler to config server pipeline for channel
(for triple protocol, it's a default handler that do nothing)
*/
- private final Map<String, ChannelHandler> supportedHandlers = new
ConcurrentHashMap<>();
+ private Map<String, ChannelHandler> supportedHandlers = new
ConcurrentHashMap<>();
Review Comment:
The field is initialized at declaration and then re-initialized in doOpen().
This creates unnecessary object creation. Either remove the declaration
initialization or the doOpen() initialization.
##########
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/pu/AbstractPortUnificationServer.java:
##########
@@ -44,14 +44,14 @@ public abstract class AbstractPortUnificationServer extends
AbstractServer {
protocol name --> URL object
wire protocol will get url object to config server pipeline for channel
*/
- private final Map<String, URL> supportedUrls = new ConcurrentHashMap<>();
+ private Map<String, URL> supportedUrls = new ConcurrentHashMap<>();
/*
protocol name --> ChannelHandler object
wire protocol will get handler to config server pipeline for channel
(for triple protocol, it's a default handler that do nothing)
*/
- private final Map<String, ChannelHandler> supportedHandlers = new
ConcurrentHashMap<>();
+ private Map<String, ChannelHandler> supportedHandlers = new
ConcurrentHashMap<>();
Review Comment:
The field is initialized at declaration and then re-initialized in doOpen().
This creates unnecessary object creation. Either remove the declaration
initialization or the doOpen() initialization.
```suggestion
private Map<String, ChannelHandler> supportedHandlers;
```
##########
dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/AbstractTimerTask.java:
##########
@@ -60,7 +60,7 @@ static Long now() {
return System.currentTimeMillis();
}
- private void start() {
+ public void start() {
Review Comment:
Changing visibility from private to public exposes internal implementation
details. Consider using a protected modifier instead if the method only needs
to be accessible to subclasses.
```suggestion
protected void start() {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]