You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2020/04/09 07:41:15 UTC
[GitHub] [zookeeper] severussundar opened a new pull request #1311:
Zookeeper 3415
severussundar opened a new pull request #1311: Zookeeper 3415
URL: https://github.com/apache/zookeeper/pull/1311
I have refactored few for loops that perform just some filtering and collections
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [zookeeper] severussundar commented on a change in pull request
#1311: Zookeeper 3415
Posted by GitBox <gi...@apache.org>.
severussundar commented on a change in pull request #1311: Zookeeper 3415
URL: https://github.com/apache/zookeeper/pull/1311#discussion_r407042738
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
##########
@@ -488,17 +488,9 @@ public void loadData() throws IOException, InterruptedException {
}
// Clean up dead sessions
- List<Long> deadSessions = new ArrayList<>();
- for (Long session : zkDb.getSessions()) {
- if (zkDb.getSessionWithTimeOuts().get(session) == null) {
- deadSessions.add(session);
- }
- }
-
- for (long session : deadSessions) {
- // TODO: Is lastProcessedZxid really the best thing to use?
- killSession(session, zkDb.getDataTreeLastProcessedZxid());
- }
+ zkDb.getSessions().stream()
Review comment:
@eolivelli Please guide me regarding the kind of refactoring expected as part of issue 3415 (https://issues.apache.org/jira/browse/ZOOKEEPER-3415)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [zookeeper] severussundar commented on a change in pull request
#1311: Zookeeper 3415
Posted by GitBox <gi...@apache.org>.
severussundar commented on a change in pull request #1311: Zookeeper 3415
URL: https://github.com/apache/zookeeper/pull/1311#discussion_r406069864
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
##########
@@ -488,17 +488,9 @@ public void loadData() throws IOException, InterruptedException {
}
// Clean up dead sessions
- List<Long> deadSessions = new ArrayList<>();
- for (Long session : zkDb.getSessions()) {
- if (zkDb.getSessionWithTimeOuts().get(session) == null) {
- deadSessions.add(session);
- }
- }
-
- for (long session : deadSessions) {
- // TODO: Is lastProcessedZxid really the best thing to use?
- killSession(session, zkDb.getDataTreeLastProcessedZxid());
- }
+ zkDb.getSessions().stream()
Review comment:
I am trying to refactor those for loops that just performs basic filtering and collections. I feel those are better accomplished using streams.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [zookeeper] eolivelli commented on a change in pull request #1311:
Zookeeper 3415
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #1311: Zookeeper 3415
URL: https://github.com/apache/zookeeper/pull/1311#discussion_r406064662
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/ZooKeeperServer.java
##########
@@ -488,17 +488,9 @@ public void loadData() throws IOException, InterruptedException {
}
// Clean up dead sessions
- List<Long> deadSessions = new ArrayList<>();
- for (Long session : zkDb.getSessions()) {
- if (zkDb.getSessionWithTimeOuts().get(session) == null) {
- deadSessions.add(session);
- }
- }
-
- for (long session : deadSessions) {
- // TODO: Is lastProcessedZxid really the best thing to use?
- killSession(session, zkDb.getDataTreeLastProcessedZxid());
- }
+ zkDb.getSessions().stream()
Review comment:
I don't find this change so useful.
Using streams does not speed up things and it usually add overhead.
Why do you want to make this change ? and the other ones ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services