[ 
https://issues.apache.org/jira/browse/BOOKKEEPER-1065?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16007087#comment-16007087
 ] 

ASF GitHub Bot commented on BOOKKEEPER-1065:
--------------------------------------------

Github user merlimat commented on the issue:

    https://github.com/apache/bookkeeper/pull/152
  
    Ok, this is the error that findbugs gives: 
    
    ```
    [INFO] --- findbugs-maven-plugin:3.0.4:check (default-cli) @ 
bookkeeper-server ---
    [INFO] BugInstance size is 1
    [INFO] Error size is 0
    [INFO] Total bugs: 1
    [INFO] Futile attempt to change max pool size of 
ScheduledThreadPoolExecutor in new 
org.apache.bookkeeper.util.OrderedSafeExecutor(String, int, ThreadFactory, 
StatsLogger, boolean, long) [org.apache.bookkeeper.util.OrderedSafeExecutor] At 
OrderedSafeExecutor.java:[line 186] 
DMI_FUTILE_ATTEMPT_TO_CHANGE_MAXPOOL_SIZE_OF_SCHEDULED_THREAD_POOL_EXECUTOR
    [INFO] 
    ```


> OrderedSafeExecutor should only have 1 thread per bucket
> --------------------------------------------------------
>
>                 Key: BOOKKEEPER-1065
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-1065
>             Project: Bookkeeper
>          Issue Type: Bug
>            Reporter: Matteo Merli
>            Assignee: Matteo Merli
>             Fix For: 4.5.0
>
>
> In a earlier commit, "BOOKKEEPER-874: Explict LAC from Writer to Bookie", 
> there was this change in the OrderedSafeExecutor implementation: 
> {noformat}
>          for (int i = 0; i < numThreads; i++) {
> -            queues[i] = new LinkedBlockingQueue<Runnable>();
> -            threads[i] =  new ThreadPoolExecutor(1, 1,
> -                    0L, TimeUnit.MILLISECONDS, queues[i],
> +            threads[i] =  new ScheduledThreadPoolExecutor(1,
>                      new ThreadFactoryBuilder()
>                          .setNameFormat(name + "-orderedsafeexecutor-" + i + 
> "-%d")
>                          .setThreadFactory(threadFactory)
>                          .build());
> +            threads[i].setMaximumPoolSize(1);
> {noformat}
> Then, as part of "BOOKKEEPER-1013: Fix findbugs errors on latest master", the 
> max pool size line has been removed.
> {noformat}
> @@ -183,7 +183,6 @@ public class OrderedSafeExecutor {
>                          .setNameFormat(name + "-orderedsafeexecutor-" + i + 
> "-%d")
>                          .setThreadFactory(threadFactory)
>                          .build());
> -            threads[i].setMaximumPoolSize(1);
>              // Save thread ids
>              final int idx = i;
> {noformat}
> Without that the thread pool would create multiple threads for the same 
> bucket, breaking the ordering guarantee of the executor.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to