Reamer commented on code in PR #4382: URL: https://github.com/apache/zeppelin/pull/4382#discussion_r912783098
########## zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Notebook.java: ########## @@ -109,6 +119,60 @@ public void recoveryIfNecessary() { } } + /** + * Subsystems can add a consumer, which is executed during initialization. + * Initialization is performed in parallel and with multiple threads. + * + * The consumer must be thread safe. + * + * @param initConsumer Consumer, which is passed the NoteId. + */ + public void addInitConsumer(Consumer<String> initConsumer) { + this.initConsumers.add(initConsumer); + } + + /** + * Asynchronous and parallel initialization of notes (during startup) + */ + public void initNotebook() { + initExecutor = new ThreadPoolExecutor(0, Runtime.getRuntime().availableProcessors(), 1, TimeUnit.MINUTES, Review Comment: The main reason is that in the method `waitForFinishInit` the ExecutorService is shut down to wait for the termination afterwards. When calling `initNotebook` again, a new ExecutorService must be created, because the old one might be closed. I will add a termination check in `initNotebook` to solve this problem. -- 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: dev-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org