prabhjyotsingh commented on a change in pull request #3468: [ZEPPELIN-4356] 
Zeppelin should stop/die/etc when can't create/access notebook repo
URL: https://github.com/apache/zeppelin/pull/3468#discussion_r329394856
 
 

 ##########
 File path: 
zeppelin-server/src/main/java/org/apache/zeppelin/server/ZeppelinServer.java
 ##########
 @@ -105,74 +106,76 @@
   @Inject
   public ZeppelinServer() {
     InterpreterOutput.limit = 
conf.getInt(ConfVars.ZEPPELIN_INTERPRETER_OUTPUT_LIMIT);
-
     packages("org.apache.zeppelin.rest");
   }
 
-  public static void main(String[] args) throws InterruptedException {
+  public static void main(String[] args) throws Exception {
     final ZeppelinConfiguration conf = ZeppelinConfiguration.create();
     conf.setProperty("args", args);
 
     jettyWebServer = setupJettyServer(conf);
 
     ContextHandlerCollection contexts = new ContextHandlerCollection();
-    jettyWebServer.setHandler(contexts);
-
-    // Web UI
-    final WebAppContext webApp = setupWebAppContext(contexts, conf);
+                jettyWebServer.setHandler(contexts);
+                // Web UI
+                final WebAppContext webApp = setupWebAppContext(contexts, 
conf);
 
     sharedServiceLocator = 
ServiceLocatorFactory.getInstance().create("shared-locator");
     ServiceLocatorUtilities.enableImmediateScope(sharedServiceLocator);
+    ServiceLocatorUtilities.addClasses(sharedServiceLocator,
+            NotebookRepoSync.class,
+            ImmediateErrorHandlerImpl.class);
+    ImmediateErrorHandlerImpl handler = 
sharedServiceLocator.getService(ImmediateErrorHandlerImpl.class);
+
     ServiceLocatorUtilities.bind(
-        sharedServiceLocator,
-        new AbstractBinder() {
-          @Override
-          protected void configure() {
-            Credentials credentials =
-                new Credentials(
-                    conf.credentialsPersist(),
-                    conf.getCredentialsPath(),
-                    conf.getCredentialsEncryptKey());
-
-            bindAsContract(InterpreterFactory.class).in(Singleton.class);
-            
bindAsContract(NotebookRepoSync.class).to(NotebookRepo.class).in(Singleton.class);
-            
bind(LuceneSearch.class).to(SearchService.class).in(Singleton.class);
-            bindAsContract(Helium.class).in(Singleton.class);
-            bind(conf).to(ZeppelinConfiguration.class);
-            
bindAsContract(InterpreterSettingManager.class).in(Singleton.class);
-            bindAsContract(InterpreterService.class).in(Singleton.class);
-            bind(credentials).to(Credentials.class);
-            bindAsContract(GsonProvider.class).in(Singleton.class);
-            
bindAsContract(WebApplicationExceptionMapper.class).in(Singleton.class);
-            bindAsContract(AdminService.class).in(Singleton.class);
-            bindAsContract(AuthorizationService.class).to(Singleton.class);
-            // TODO(jl): Will make it more beautiful
-            if (!StringUtils.isBlank(conf.getShiroPath())) {
-              
bind(ShiroAuthenticationService.class).to(AuthenticationService.class).in(Singleton.class);
-            } else {
-              // TODO(jl): Will be added more type
-              
bind(NoAuthenticationService.class).to(AuthenticationService.class).in(Singleton.class);
-            }
-            bindAsContract(HeliumBundleFactory.class).in(Singleton.class);
-            bindAsContract(HeliumApplicationFactory.class).in(Singleton.class);
-            bindAsContract(ConfigurationService.class).in(Singleton.class);
-            bindAsContract(NotebookService.class).in(Singleton.class);
-            bindAsContract(JobManagerService.class).in(Singleton.class);
-            bindAsContract(Notebook.class).in(Singleton.class);
-            bindAsContract(NotebookServer.class)
-                .to(AngularObjectRegistryListener.class)
-                .to(RemoteInterpreterProcessListener.class)
-                .to(ApplicationEventListener.class)
-                .to(NoteEventListener.class)
-                .to(WebSocketServlet.class)
-                .in(Singleton.class);
-            if (conf.isZeppelinNotebookCronEnable()) {
-              
bind(QuartzSchedulerService.class).to(SchedulerService.class).in(Singleton.class);
-            } else {
-              
bind(NoSchedulerService.class).to(SchedulerService.class).in(Singleton.class);
-            }
-          }
-        });
+            sharedServiceLocator,
+            new AbstractBinder() {
+              @Override
+              protected void configure() {
+                Credentials credentials =
+                        new Credentials(
+                                conf.credentialsPersist(),
+                                conf.getCredentialsPath(),
+                                conf.getCredentialsEncryptKey());
+                bindAsContract(InterpreterFactory.class).in(Singleton.class);
+                bind(conf).to(ZeppelinConfiguration.class);
+                
bindAsContract(NotebookRepoSync.class).to(NotebookRepo.class).in(Immediate.class);
 
 Review comment:
   Can you add this `Immediate` to `ShiroAuthenticationService` as well? I 
believe these two are important services as without these properly initialized 
Zeppelin in unusable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to