@@ -237,8 +237,7 @@ public boolean accept(Path entry) throws IOException {
237237 interpreterInfo =
238238 new InterpreterInfo (r .getClassName (), r .getName (), r .isDefaultInterpreter (),
239239 r .getEditor ());
240- add (r .getGroup (), interpreterInfo , convertInterpreterProperties (r .getProperties ()),
241- r .getPath ());
240+ add (r .getGroup (), interpreterInfo , r .getProperties (), r .getPath ());
242241 }
243242
244243 for (String settingId : interpreterSettingsRef .keySet ()) {
@@ -286,7 +285,8 @@ private InterpreterSetting createFromInterpreterSettingRef(String name) {
286285
287286 private InterpreterSetting createFromInterpreterSettingRef (InterpreterSetting o ) {
288287 InterpreterSetting setting =
289- new InterpreterSetting (o .getName (), o .getName (), o .getInterpreterInfos (), o .getProperties (),
288+ new InterpreterSetting (o .getName (), o .getName (), o .getInterpreterInfos (),
289+ convertInterpreterProperties ((Map <String , InterpreterProperty >)o .getProperties ()),
290290 o .getDependencies (), o .getOption (), o .getPath ());
291291 setting .setInterpreterGroupFactory (this );
292292 return setting ;
@@ -349,16 +349,9 @@ private void registerInterpreters(List<RegisteredInterpreter> registeredInterpre
349349 InterpreterInfo interpreterInfo =
350350 new InterpreterInfo (registeredInterpreter .getClassName (), registeredInterpreter .getName (),
351351 registeredInterpreter .isDefaultInterpreter (), registeredInterpreter .getEditor ());
352- Properties properties = new Properties ();
353- Map <String , InterpreterProperty > p = registeredInterpreter .getProperties ();
354352
355- if (null != p ) {
356- for (String key : p .keySet ()) {
357- properties .setProperty (key , p .get (key ).getValue ());
358- }
359- }
360-
361- add (registeredInterpreter .getGroup (), interpreterInfo , properties , absolutePath );
353+ add (registeredInterpreter .getGroup (), interpreterInfo , registeredInterpreter .getProperties (),
354+ absolutePath );
362355 }
363356
364357 }
@@ -615,24 +608,25 @@ public InterpreterSetting createNewSetting(String name, String group,
615608 }
616609
617610 private InterpreterSetting add (String group , InterpreterInfo interpreterInfo ,
618- Properties properties , String path )
611+ Map < String , InterpreterProperty > interpreterProperties , String path )
619612 throws InterpreterException , IOException , RepositoryException {
620613 ArrayList <InterpreterInfo > infos = new ArrayList <>();
621614 infos .add (interpreterInfo );
622- return add (group , infos , new ArrayList <Dependency >(), defaultOption , properties , path );
615+ return add (group , infos , new ArrayList <Dependency >(), defaultOption , interpreterProperties , path );
623616 }
624617
625618 /**
626619 * @param group InterpreterSetting reference name
627620 * @return
628621 */
629622 public InterpreterSetting add (String group , ArrayList <InterpreterInfo > interpreterInfos ,
630- List <Dependency > dependencies , InterpreterOption option , Properties properties , String path ) {
623+ List <Dependency > dependencies , InterpreterOption option ,
624+ Map <String , InterpreterProperty > interpreterProperties , String path ) {
631625 Preconditions .checkNotNull (group , "name should not be null" );
632626 Preconditions .checkNotNull (interpreterInfos , "interpreterInfos should not be null" );
633627 Preconditions .checkNotNull (dependencies , "dependencies should not be null" );
634628 Preconditions .checkNotNull (option , "option should not be null" );
635- Preconditions .checkNotNull (properties , "properties should not be null" );
629+ Preconditions .checkNotNull (interpreterProperties , "properties should not be null" );
636630
637631 InterpreterSetting interpreterSetting ;
638632
@@ -663,16 +657,17 @@ public InterpreterSetting add(String group, ArrayList<InterpreterInfo> interpret
663657 }
664658
665659 // Append properties
666- Properties interpreterProperties = interpreterSetting .getProperties ();
667- for (String key : properties .stringPropertyNames ()) {
668- if (!interpreterProperties .containsKey (key )) {
669- interpreterProperties .setProperty (key , properties .getProperty (key ));
660+ Map <String , InterpreterProperty > properties =
661+ (Map <String , InterpreterProperty >) interpreterSetting .getProperties ();
662+ for (String key : interpreterProperties .keySet ()) {
663+ if (!properties .containsKey (key )) {
664+ properties .put (key , interpreterProperties .get (key ));
670665 }
671666 }
672667
673668 } else {
674669 interpreterSetting =
675- new InterpreterSetting (group , null , interpreterInfos , properties , dependencies , option ,
670+ new InterpreterSetting (group , null , interpreterInfos , interpreterProperties , dependencies , option ,
676671 path );
677672 interpreterSettingsRef .put (group , interpreterSetting );
678673 }
@@ -734,7 +729,7 @@ public void createInterpretersForNote(InterpreterSetting interpreterSetting, Str
734729 String noteId , String key ) {
735730 InterpreterGroup interpreterGroup = interpreterSetting .getInterpreterGroup (user , noteId );
736731 InterpreterOption option = interpreterSetting .getOption ();
737- Properties properties = interpreterSetting .getProperties ();
732+ Properties properties = ( Properties ) interpreterSetting .getProperties ();
738733 if (option .isExistingProcess ) {
739734 properties .put (Constants .ZEPPELIN_INTERPRETER_HOST , option .getHost ());
740735 properties .put (Constants .ZEPPELIN_INTERPRETER_PORT , option .getPort ());
@@ -932,16 +927,16 @@ private List<String> getNoteInterpreterSettingBinding(String noteId) {
932927 public void setPropertyAndRestart (String id , InterpreterOption option , Properties properties ,
933928 List <Dependency > dependencies ) throws IOException {
934929 synchronized (interpreterSettings ) {
935- InterpreterSetting intpsetting = interpreterSettings .get (id );
936- if (intpsetting != null ) {
930+ InterpreterSetting intpSetting = interpreterSettings .get (id );
931+ if (intpSetting != null ) {
937932 try {
938- stopJobAllInterpreter (intpsetting );
933+ stopJobAllInterpreter (intpSetting );
939934
940- intpsetting .closeAndRmoveAllInterpreterGroups ();
941- intpsetting .setOption (option );
942- intpsetting .setProperties (properties );
943- intpsetting .setDependencies (dependencies );
944- loadInterpreterDependencies (intpsetting );
935+ intpSetting .closeAndRmoveAllInterpreterGroups ();
936+ intpSetting .setOption (option );
937+ intpSetting .setProperties (properties );
938+ intpSetting .setDependencies (dependencies );
939+ loadInterpreterDependencies (intpSetting );
945940
946941 saveToFile ();
947942 } catch (Exception e ) {
@@ -960,38 +955,37 @@ private boolean noteIdIsExist(String noteId) {
960955 }
961956
962957 public void restart (String settingId , String noteId ) {
963- InterpreterSetting intpsetting = interpreterSettings .get (settingId );
964- Preconditions .checkNotNull (intpsetting );
958+ InterpreterSetting intpSetting = interpreterSettings .get (settingId );
959+ Preconditions .checkNotNull (intpSetting );
965960
966- if (noteIdIsExist (noteId ) &&
967- intpsetting .getOption ().isProcess ()) {
968- intpsetting .closeAndRemoveInterpreterGroup (noteId );
961+ if (noteIdIsExist (noteId ) && intpSetting .getOption ().isProcess ()) {
962+ intpSetting .closeAndRemoveInterpreterGroup (noteId );
969963 return ;
970964 }
971965 restart (settingId );
972966 }
973967
974968 public void restart (String id ) {
975969 synchronized (interpreterSettings ) {
976- InterpreterSetting intpsetting = interpreterSettings .get (id );
970+ InterpreterSetting intpSetting = interpreterSettings .get (id );
977971 // Check if dependency in specified path is changed
978972 // If it did, overwrite old dependency jar with new one
979- if (intpsetting != null ) {
980- copyDependenciesFromLocalPath (intpsetting );
973+ if (intpSetting != null ) {
974+ copyDependenciesFromLocalPath (intpSetting );
981975
982- stopJobAllInterpreter (intpsetting );
976+ stopJobAllInterpreter (intpSetting );
983977
984- intpsetting .closeAndRmoveAllInterpreterGroups ();
978+ intpSetting .closeAndRmoveAllInterpreterGroups ();
985979
986980 } else {
987981 throw new InterpreterException ("Interpreter setting id " + id + " not found" );
988982 }
989983 }
990984 }
991985
992- private void stopJobAllInterpreter (InterpreterSetting intpsetting ) {
993- if (intpsetting != null ) {
994- for (InterpreterGroup intpGroup : intpsetting .getAllInterpreterGroups ()) {
986+ private void stopJobAllInterpreter (InterpreterSetting intpSetting ) {
987+ if (intpSetting != null ) {
988+ for (InterpreterGroup intpGroup : intpSetting .getAllInterpreterGroups ()) {
995989 for (List <Interpreter > interpreters : intpGroup .values ()) {
996990 for (Interpreter intp : interpreters ) {
997991 for (Job job : intp .getScheduler ().getJobsRunning ()) {
@@ -1013,11 +1007,11 @@ private void stopJobAllInterpreter(InterpreterSetting intpsetting) {
10131007 public void close () {
10141008 List <Thread > closeThreads = new LinkedList <>();
10151009 synchronized (interpreterSettings ) {
1016- Collection <InterpreterSetting > intpsettings = interpreterSettings .values ();
1017- for (final InterpreterSetting intpsetting : intpsettings ) {
1010+ Collection <InterpreterSetting > intpSettings = interpreterSettings .values ();
1011+ for (final InterpreterSetting intpSetting : intpSettings ) {
10181012 Thread t = new Thread () {
10191013 public void run () {
1020- intpsetting .closeAndRmoveAllInterpreterGroups ();
1014+ intpSetting .closeAndRmoveAllInterpreterGroups ();
10211015 }
10221016 };
10231017 t .start ();
0 commit comments