This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new c8bcecc  Allow bookie to start if failed to load extra server 
components
c8bcecc is described below

commit c8bcecc3fb38932a2e6444d5362ad1d82ee630af
Author: Sijie Guo <[email protected]>
AuthorDate: Tue May 22 01:43:46 2018 -0700

    Allow bookie to start if failed to load extra server components
    
    Descriptions of the changes in this PR:
    
    *Motivation*
    
    `extraServerComponents` provides the flexibility to allow bookie to start 
with extra server components.
    It acts as a plugin mechanism to extend the functionality of bookies. 
However it is okay to allow bookie
    start up when failed to load extra server components.
    
    This is a change for allowing starting table service as extra components in 
bookies.
    
    *Solution*
    
    Catch the exception and log it when failed to load extra server components.
    
    Author: Sijie Guo <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>, Jia Zhai <None>
    
    This closes #1420 from sijie/allow_start_bookie
---
 .../main/java/org/apache/bookkeeper/server/Main.java | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
index 4815fee..1ef56de 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
@@ -48,6 +48,7 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.lang3.StringUtils;
 
 /**
  * A bookie server is a server that run bookie and serving rpc requests.
@@ -327,13 +328,18 @@ public class Main {
         // 5. build extra services
         String[] extraComponents = 
conf.getServerConf().getExtraServerComponents();
         if (null != extraComponents) {
-            List<ServerLifecycleComponent> components = loadServerComponents(
-                extraComponents,
-                conf,
-                rootStatsLogger);
-            for (ServerLifecycleComponent component : components) {
-                serverBuilder.addComponent(component);
-                log.info("Load lifecycle component : {}", 
component.getClass().getName());
+            try {
+                List<ServerLifecycleComponent> components = 
loadServerComponents(
+                    extraComponents,
+                    conf,
+                    rootStatsLogger);
+                for (ServerLifecycleComponent component : components) {
+                    serverBuilder.addComponent(component);
+                    log.info("Load lifecycle component : {}", 
component.getClass().getName());
+                }
+            } catch (Exception e) {
+                log.info("Failed to load extra components '{}' - {}. 
Continuing without those components.",
+                    StringUtils.join(extraComponents), e.getMessage());
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to