You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "javanna (via GitHub)" <gi...@apache.org> on 2023/05/10 21:55:36 UTC

[GitHub] [lucene] javanna opened a new pull request, #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

javanna opened a new pull request, #12285:
URL: https://github.com/apache/lucene/pull/12285

   The only behaviour that QueueSizeBasedExecutor overrides from SliceExecutor is when to execute on the caller thread. There is no need to override the whole invokeAll method for that. Instead, this commit introduces a shouldExecuteOnCallerThread method that can be overridden.
   
   


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna merged pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "javanna (via GitHub)" <gi...@apache.org>.
javanna merged PR #12285:
URL: https://github.com/apache/lucene/pull/12285


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] romseygeek commented on a diff in pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "romseygeek (via GitHub)" <gi...@apache.org>.
romseygeek commented on code in PR #12285:
URL: https://github.com/apache/lucene/pull/12285#discussion_r1190841595


##########
lucene/core/src/java/org/apache/lucene/search/SliceExecutor.java:
##########
@@ -28,54 +29,30 @@
 class SliceExecutor {
   private final Executor executor;
 
-  public SliceExecutor(Executor executor) {
-    this.executor = executor;
+  SliceExecutor(Executor executor) {
+    this.executor = Objects.requireNonNull(executor, "Executor is null");
   }
 
-  public void invokeAll(Collection<? extends Runnable> tasks) {
-
-    if (tasks == null) {

Review Comment:
   Do we not need this null check for `tasks` any more?  Maybe replace it with an assertion given this is all package private?



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a diff in pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "javanna (via GitHub)" <gi...@apache.org>.
javanna commented on code in PR #12285:
URL: https://github.com/apache/lucene/pull/12285#discussion_r1190852583


##########
lucene/core/src/java/org/apache/lucene/search/SliceExecutor.java:
##########
@@ -28,54 +29,30 @@
 class SliceExecutor {
   private final Executor executor;
 
-  public SliceExecutor(Executor executor) {
-    this.executor = executor;
+  SliceExecutor(Executor executor) {
+    this.executor = Objects.requireNonNull(executor, "Executor is null");
   }
 
-  public void invokeAll(Collection<? extends Runnable> tasks) {
-
-    if (tasks == null) {

Review Comment:
   it is going to throw NPE two lines below once we loop through it, I am not sure I see value in checking that here, do you?



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on a diff in pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "javanna (via GitHub)" <gi...@apache.org>.
javanna commented on code in PR #12285:
URL: https://github.com/apache/lucene/pull/12285#discussion_r1190872180


##########
lucene/core/src/java/org/apache/lucene/search/SliceExecutor.java:
##########
@@ -28,54 +29,30 @@
 class SliceExecutor {
   private final Executor executor;
 
-  public SliceExecutor(Executor executor) {
-    this.executor = executor;
+  SliceExecutor(Executor executor) {
+    this.executor = Objects.requireNonNull(executor, "Executor is null");
   }
 
-  public void invokeAll(Collection<? extends Runnable> tasks) {
-
-    if (tasks == null) {

Review Comment:
   oh I see, I was thinking of replacing the if with `Objects.requireNonNull` which would still throw NPE, but you would have preferred IAE then I guess. Given that this is package private and we really can't ever have a null list, I would skip checking.



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] romseygeek commented on a diff in pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "romseygeek (via GitHub)" <gi...@apache.org>.
romseygeek commented on code in PR #12285:
URL: https://github.com/apache/lucene/pull/12285#discussion_r1190854871


##########
lucene/core/src/java/org/apache/lucene/search/SliceExecutor.java:
##########
@@ -28,54 +29,30 @@
 class SliceExecutor {
   private final Executor executor;
 
-  public SliceExecutor(Executor executor) {
-    this.executor = executor;
+  SliceExecutor(Executor executor) {
+    this.executor = Objects.requireNonNull(executor, "Executor is null");
   }
 
-  public void invokeAll(Collection<? extends Runnable> tasks) {
-
-    if (tasks == null) {

Review Comment:
   I'm allergic to NPEs in general...  But maybe that's not a problem now with nicer messages from later JDKs? Up to you :)



-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org


[GitHub] [lucene] javanna commented on pull request #12285: Simplify SliceExecutor and QueueSizeBasedExecutor

Posted by "javanna (via GitHub)" <gi...@apache.org>.
javanna commented on PR #12285:
URL: https://github.com/apache/lucene/pull/12285#issuecomment-1543626866

   thanks @romseygeek !


-- 
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: issues-unsubscribe@lucene.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org