sijie commented on issue #202: DistributedLogManager's getLastDLSN runs long time, especially after reOpen log stream URL: https://github.com/apache/distributedlog/issues/202#issuecomment-335278147 @ArvinDevel ``` dlm.openAsyncLogWriter().whenComplete(new FutureEventListener<AsyncLogWriter>() { @Override public void onSuccess(AsyncLogWriter asyncLogWriter) { LOG.info("[{}] Created log writer {}", name, asyncLogWriter.toString()); logWriter = asyncLogWriter; try { LOG.info("before getLastDLSN"); last = dlm.getLastDLSN(); LOG.info("after getLastDLSN"); } catch (LogEmptyException lee){ LOG.info("the log stream is empty "); } catch (Exception e){ LOG.error("Faced Exception in getLastDLSN", e); } LOG.info("getLastDLSN return {}", last); openLatch.countDown(); } @Override public void onFailure(Throwable throwable) { LOG.error("Failed open AsyncLogWriter for {}", name, throwable); openLatch.countDown(); } }); ``` You can call synchronous function in an asynchronous callback. since the synchronous function is blocking the callback thread. so getLastDLSN will never complete. ---------------------------------------------------------------- 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: [email protected]
With regards, Apache Git Services
