You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/06/05 10:12:46 UTC

[GitHub] infodog commented on issue #1476: recycle already.

infodog commented on issue #1476: recycle already.
URL: https://github.com/apache/bookkeeper/issues/1476#issuecomment-394656506
 
 
   @sijie my situation is when one process reading from the log, and one process writing to the log, the writer is fast.
    when this exception happened, the reader will stop working. 
   
   my code of reading is like following:
   while (true) {
               try {
   
                   while (true) {
                       try {
                           LogRecord record = reader.readNext(false);
                           if (record == null) {
                               break;
                           }
                           System.out.println("read record, txid=" + record.getTransactionId() + ", lastShardId=" + lastShardTxId);
                           if (record.getTransactionId() > getLocalLastTxId()) {
                               updateLog(record);
                           }
                           // read next record
                       } catch (LogEmptyException t) {
                           //没事
                           System.out.println("no record in log.");
                       } catch (Throwable ioe) {
                           // handle the exception
                           nextTxId = getLocalLastTxId();
                           reader = dlm.getInputStream(nextTxId);
                       }
   
                   }
   
   
                   if (isSwitchingToMaster) {
                       return;
                   }
                   synchronized (downloadThreadMonitor) {
                       downloadThreadMonitor.wait(100);
                   }
                   if (isSwitchingToMaster) {
                       return;
                   }
               } catch (Throwable e) {
                   e.printStackTrace();
               }
           }

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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