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

Rakesh R commented on BOOKKEEPER-654:
-------------------------------------

Thanks [~hustlmsp] for the comments. Few clarifications:
bq.1. in OrderedSafeExecutor, why not just catch the rejected exception rather 
than adding an extra boolean flag. since this flag doesn't avoid throwing 
rejected exception.

>From ThreadPoolExecutor JavaDoc, it says, will be rejected when the Executor 
>has been shut down, and also when the Executor uses finite bounds for both 
>maximum threads and work queue capacity, and is saturated.

ThreadPoolExecutor.java
{code}
public void execute(Runnable command) {
    //....
    //....
    reject(command); // is shutdown or saturated
{code}

I've added the flag to convey to the user about the actual cause(either due to 
bk.close() or some other reason). Otherwise we need to iterate over the 
'executor.threads[i]' and see whether its shutdown like below. Any other better 
way to handle this?
OrderedSafeExecutor.java
{code}
            for (int i = 0; i < executor.threads.length; i++) {
                if(executor.threads[i].isShutdown()){
                      
safeOperationComplete(BKException.Code.BkClientClosedException,
                        result);
                      return;
                }
            }
{code}

bq.2. in LedgerOpenOp, why we need #readComplete here? an unscheduled 
speculative task doesn't affect any logic. 
If we throws exception back to the caller, (callers are: 
LedgerRecovery#doRecoveryRead() and LedgerHandle.asyncReadEntries()) callers 
need to duplicate the logic of handling the exception and return the 
BkClientClosedException. Whats your opinion?

Also, I need to remove 'if(bk.bookieClient.isClosed())' check added at 
LedgerHandle.asyncReadEntries(), its not required.


                
> Bookkeeper client operations are allowed even after its closure, bk#close()
> ---------------------------------------------------------------------------
>
>                 Key: BOOKKEEPER-654
>                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-654
>             Project: Bookkeeper
>          Issue Type: Bug
>          Components: bookkeeper-client
>    Affects Versions: 4.2.0
>            Reporter: Rakesh R
>            Assignee: Rakesh R
>             Fix For: 4.2.2, 4.3.0
>
>         Attachments: 0001-BOOKKEEPER-654-testcase-to-understand-more.patch, 
> 0002-BOOKKEEPER-654.patch, 0003-BOOKKEEPER-654.patch
>
>
> User can perform below operations with the closed bookkeeper client, which 
> was instantiated with external zkclient.
> - open a closed ledger 
> - create a new ledger 
> Also, ledgerhandle operations like fencing/add/write are infinitely hanging.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to