http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java index cb2f9f1..e1ee73f 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java @@ -17,7 +17,15 @@ package org.apache.zeppelin.interpreter; - +import java.lang.reflect.Field; +import java.net.URL; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.reflect.FieldUtils; import org.apache.zeppelin.annotation.Experimental; @@ -30,46 +38,32 @@ import org.apache.zeppelin.scheduler.SchedulerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.lang.reflect.Field; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - /** - * Interface for interpreters. - * If you want to implement new Zeppelin interpreter, extend this class + * Interface for interpreters. If you want to implement new Zeppelin interpreter, extend this class * - * Please see, + * <p>Please see, * https://zeppelin.apache.org/docs/latest/development/writingzeppelininterpreter.html * - * open(), close(), interpret() is three the most important method you need to implement. - * cancel(), getProgress(), completion() is good to have - * getFormType(), getScheduler() determine Zeppelin's behavior + * <p>open(), close(), interpret() is three the most important method you need to implement. + * cancel(), getProgress(), completion() is good to have getFormType(), getScheduler() determine + * Zeppelin's behavior */ public abstract class Interpreter { /** - * Opens interpreter. You may want to place your initialize routine here. - * open() is called only once + * Opens interpreter. You may want to place your initialize routine here. open() is called only + * once */ @ZeppelinApi public abstract void open() throws InterpreterException; /** - * Closes interpreter. You may want to free your resources up here. - * close() is called only once + * Closes interpreter. You may want to free your resources up here. close() is called only once */ @ZeppelinApi public abstract void close() throws InterpreterException; - /** - * Run precode if exists. - */ + /** Run precode if exists. */ @ZeppelinApi public InterpreterResult executePrecode(InterpreterContext interpreterContext) throws InterpreterException { @@ -93,10 +87,8 @@ public abstract class Interpreter { // substitute {variable} only if 'variable' has a value ... Resource resource = resourcePool.get(varPat.substring(1, varPat.length() - 1)); Object variableValue = resource == null ? null : resource.get(); - if (variableValue != null) - sb.append(variableValue); - else - return cmd; + if (variableValue != null) sb.append(variableValue); + else return cmd; } else if (varPat.matches("[{]{2}[^{}]+[}]{2}")) { // escape {{text}} ... sb.append("{").append(varPat.substring(2, varPat.length() - 2)).append("}"); @@ -116,22 +108,18 @@ public abstract class Interpreter { * @param st statements to run */ @ZeppelinApi - public abstract InterpreterResult interpret(String st, - InterpreterContext context) + public abstract InterpreterResult interpret(String st, InterpreterContext context) throws InterpreterException; - /** - * Optionally implement the canceling routine to abort interpret() method - */ + /** Optionally implement the canceling routine to abort interpret() method */ @ZeppelinApi public abstract void cancel(InterpreterContext context) throws InterpreterException; /** - * Dynamic form handling - * see http://zeppelin.apache.org/docs/dynamicform.html + * Dynamic form handling see http://zeppelin.apache.org/docs/dynamicform.html * * @return FormType.SIMPLE enables simple pattern replacement (eg. Hello ${name=world}), - * FormType.NATIVE handles form in API + * FormType.NATIVE handles form in API */ @ZeppelinApi public abstract FormType getFormType() throws InterpreterException; @@ -145,8 +133,8 @@ public abstract class Interpreter { public abstract int getProgress(InterpreterContext context) throws InterpreterException; /** - * Get completion list based on cursor position. - * By implementing this method, it enables auto-completion. + * Get completion list based on cursor position. By implementing this method, it enables + * auto-completion. * * @param buf statements * @param cursor cursor position in statements @@ -154,22 +142,22 @@ public abstract class Interpreter { * @return list of possible completion. Return empty list if there're nothing to return. */ @ZeppelinApi - public List<InterpreterCompletion> completion(String buf, int cursor, - InterpreterContext interpreterContext) throws InterpreterException { + public List<InterpreterCompletion> completion( + String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { return null; } /** - * Interpreter can implements it's own scheduler by overriding this method. - * There're two default scheduler provided, FIFO, Parallel. - * If your interpret() can handle concurrent request, use Parallel or use FIFO. + * Interpreter can implements it's own scheduler by overriding this method. There're two default + * scheduler provided, FIFO, Parallel. If your interpret() can handle concurrent request, use + * Parallel or use FIFO. * - * You can get default scheduler by using + * <p>You can get default scheduler by using * SchedulerFactory.singleton().createOrGetFIFOScheduler() * SchedulerFactory.singleton().createOrGetParallelScheduler() * * @return return scheduler instance. This method can be called multiple times and have to return - * the same instance. Can not return null. + * the same instance. Can not return null. */ @ZeppelinApi public Scheduler getScheduler() { @@ -366,51 +354,62 @@ public abstract class Interpreter { } /** - * Replace markers #{contextFieldName} by values from {@link InterpreterContext} fields - * with same name and marker #{user}. If value == null then replace by empty string. + * Replace markers #{contextFieldName} by values from {@link InterpreterContext} fields with same + * name and marker #{user}. If value == null then replace by empty string. */ private void replaceContextParameters(Properties properties) { InterpreterContext interpreterContext = InterpreterContext.get(); if (interpreterContext != null) { String markerTemplate = "#\\{%s\\}"; List<String> skipFields = Arrays.asList("paragraphTitle", "paragraphId", "paragraphText"); - List typesToProcess = Arrays.asList(String.class, Double.class, Float.class, Short.class, - Byte.class, Character.class, Boolean.class, Integer.class, Long.class); + List typesToProcess = + Arrays.asList( + String.class, + Double.class, + Float.class, + Short.class, + Byte.class, + Character.class, + Boolean.class, + Integer.class, + Long.class); for (String key : properties.stringPropertyNames()) { String p = properties.getProperty(key); if (StringUtils.isNotEmpty(p)) { for (Field field : InterpreterContext.class.getDeclaredFields()) { Class clazz = field.getType(); - if (!skipFields.contains(field.getName()) && (typesToProcess.contains(clazz) - || clazz.isPrimitive())) { + if (!skipFields.contains(field.getName()) + && (typesToProcess.contains(clazz) || clazz.isPrimitive())) { Object value = null; try { value = FieldUtils.readField(field, interpreterContext, true); } catch (Exception e) { logger.error("Cannot read value of field {0}", field.getName()); } - p = p.replaceAll(String.format(markerTemplate, field.getName()), - value != null ? value.toString() : StringUtils.EMPTY); + p = + p.replaceAll( + String.format(markerTemplate, field.getName()), + value != null ? value.toString() : StringUtils.EMPTY); } } - p = p.replaceAll(String.format(markerTemplate, "user"), - StringUtils.defaultString(userName, StringUtils.EMPTY)); + p = + p.replaceAll( + String.format(markerTemplate, "user"), + StringUtils.defaultString(userName, StringUtils.EMPTY)); properties.setProperty(key, p); } } } } - /** - * Type of interpreter. - */ + /** Type of interpreter. */ public enum FormType { - NATIVE, SIMPLE, NONE + NATIVE, + SIMPLE, + NONE } - /** - * Represent registered interpreter class - */ + /** Represent registered interpreter class */ public static class RegisteredInterpreter { private String group; @@ -423,13 +422,20 @@ public abstract class Interpreter { private InterpreterOption option; private InterpreterRunner runner; - public RegisteredInterpreter(String name, String group, String className, + public RegisteredInterpreter( + String name, + String group, + String className, Map<String, DefaultInterpreterProperty> properties) { this(name, group, className, false, properties); } - public RegisteredInterpreter(String name, String group, String className, - boolean defaultInterpreter, Map<String, DefaultInterpreterProperty> properties) { + public RegisteredInterpreter( + String name, + String group, + String className, + boolean defaultInterpreter, + Map<String, DefaultInterpreterProperty> properties) { super(); this.name = name; this.group = group; @@ -488,11 +494,9 @@ public abstract class Interpreter { } } - /** - * Type of Scheduling. - */ + /** Type of Scheduling. */ public enum SchedulingMode { - FIFO, PARALLEL + FIFO, + PARALLEL } - }
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java index 23ac789..07d9e40 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterContext.java @@ -17,18 +17,15 @@ package org.apache.zeppelin.interpreter; +import java.util.HashMap; +import java.util.Map; import org.apache.zeppelin.display.AngularObjectRegistry; import org.apache.zeppelin.display.GUI; import org.apache.zeppelin.interpreter.remote.RemoteInterpreterEventClient; import org.apache.zeppelin.resource.ResourcePool; import org.apache.zeppelin.user.AuthenticationInfo; -import java.util.HashMap; -import java.util.Map; - -/** - * Interpreter context - */ +/** Interpreter context */ public class InterpreterContext { private static final ThreadLocal<InterpreterContext> threadIC = new ThreadLocal<>(); @@ -63,9 +60,7 @@ public class InterpreterContext { private Map<String, String> localProperties = new HashMap<>(); private RemoteInterpreterEventClient intpEventClient; - /** - * Builder class for InterpreterContext - */ + /** Builder class for InterpreterContext */ public static class Builder { private InterpreterContext context; @@ -168,10 +163,7 @@ public class InterpreterContext { return new Builder(); } - private InterpreterContext() { - - } - + private InterpreterContext() {} public String getNoteId() { return noteId; @@ -228,7 +220,7 @@ public class InterpreterContext { public String getInterpreterClassName() { return interpreterClassName; } - + public void setInterpreterClassName(String className) { this.interpreterClassName = className; } @@ -247,6 +239,7 @@ public class InterpreterContext { /** * Set progress of paragraph manually + * * @param n integer from 0 to 100 */ public void setProgress(int n) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java index 1ce63f3..6c1aa24 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterException.java @@ -17,15 +17,10 @@ package org.apache.zeppelin.interpreter; - -/** - * General Exception for interpreters. - * - */ +/** General Exception for interpreters. */ public class InterpreterException extends Exception { - public InterpreterException() { - } + public InterpreterException() {} public InterpreterException(Throwable e) { super(e); @@ -39,8 +34,8 @@ public class InterpreterException extends Exception { super(msg, t); } - public InterpreterException(String message, Throwable cause, boolean enableSuppression, - boolean writableStackTrace) { + public InterpreterException( + String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java index 4cf4b31..638a391 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterGroup.java @@ -17,30 +17,28 @@ package org.apache.zeppelin.interpreter; -import org.apache.zeppelin.display.AngularObjectRegistry; -import org.apache.zeppelin.resource.ResourcePool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - +import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; -import java.security.SecureRandom; import java.util.concurrent.ConcurrentHashMap; +import org.apache.zeppelin.display.AngularObjectRegistry; +import org.apache.zeppelin.resource.ResourcePool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * InterpreterGroup is collections of interpreter sessions. - * One session could include multiple interpreters. - * For example spark, pyspark, sql interpreters are in the same 'spark' interpreter session. + * InterpreterGroup is collections of interpreter sessions. One session could include multiple + * interpreters. For example spark, pyspark, sql interpreters are in the same 'spark' interpreter + * session. * - * Remember, list of interpreters are dedicated to a session. Session could be shared across user - * or notes, so the sessionId could be user or noteId or their combination. - * So InterpreterGroup internally manages map of [sessionId(noteId, user, or - * their combination), list of interpreters] + * <p>Remember, list of interpreters are dedicated to a session. Session could be shared across user + * or notes, so the sessionId could be user or noteId or their combination. So InterpreterGroup + * internally manages map of [sessionId(noteId, user, or their combination), list of interpreters] * - * A InterpreterGroup runs interpreter process while its subclass ManagedInterpreterGroup runs - * in zeppelin server process. + * <p>A InterpreterGroup runs interpreter process while its subclass ManagedInterpreterGroup runs in + * zeppelin server process. */ public class InterpreterGroup { @@ -56,15 +54,14 @@ public class InterpreterGroup { /** * Create InterpreterGroup with given id, used in InterpreterProcess + * * @param id */ public InterpreterGroup(String id) { this.id = id; } - /** - * Create InterpreterGroup with autogenerated id - */ + /** Create InterpreterGroup with autogenerated id */ public InterpreterGroup() { this.id = generateId(); } @@ -77,12 +74,12 @@ public class InterpreterGroup { return this.id; } - //TODO(zjffdu) change it to getSession. For now just keep this method to reduce code change + // TODO(zjffdu) change it to getSession. For now just keep this method to reduce code change public synchronized List<Interpreter> get(String sessionId) { return sessions.get(sessionId); } - //TODO(zjffdu) change it to addSession. For now just keep this method to reduce code change + // TODO(zjffdu) change it to addSession. For now just keep this method to reduce code change public synchronized void put(String sessionId, List<Interpreter> interpreters) { this.sessions.put(sessionId, interpreters); } @@ -97,8 +94,8 @@ public class InterpreterGroup { put(sessionId, interpreters); } - //TODO(zjffdu) rename it to a more proper name. - //For now just keep this method to reduce code change + // TODO(zjffdu) rename it to a more proper name. + // For now just keep this method to reduce code change public Collection<List<Interpreter>> values() { return sessions.values(); } @@ -106,15 +103,15 @@ public class InterpreterGroup { public AngularObjectRegistry getAngularObjectRegistry() { return angularObjectRegistry; } - + public void setAngularObjectRegistry(AngularObjectRegistry angularObjectRegistry) { this.angularObjectRegistry = angularObjectRegistry; } - + public InterpreterHookRegistry getInterpreterHookRegistry() { return hookRegistry; } - + public void setInterpreterHookRegistry(InterpreterHookRegistry hookRegistry) { this.hookRegistry = hookRegistry; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java index d0dbad1..e47c511 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookListener.java @@ -17,17 +17,11 @@ package org.apache.zeppelin.interpreter; -/** - * An interface for processing custom callback code into the interpreter. - */ +/** An interface for processing custom callback code into the interpreter. */ public interface InterpreterHookListener { - /** - * Prepends pre-execute hook code to the script that will be interpreted - */ + /** Prepends pre-execute hook code to the script that will be interpreted */ void onPreExecute(String script); - - /** - * Appends post-execute hook code to the script that will be interpreted - */ + + /** Appends post-execute hook code to the script that will be interpreted */ void onPostExecute(String script); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java index 83917ec..6b8a449 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterHookRegistry.java @@ -23,10 +23,10 @@ import java.util.Map; import java.util.Set; /** - * The InterpreterHookRegistry specifies code to be conditionally executed by an - * interpreter. The constants defined in this class denote currently - * supported events. Each instance is bound to a single InterpreterGroup. - * Scope is determined on a per-note basis (except when null for global scope). + * The InterpreterHookRegistry specifies code to be conditionally executed by an interpreter. The + * constants defined in this class denote currently supported events. Each instance is bound to a + * single InterpreterGroup. Scope is determined on a per-note basis (except when null for global + * scope). */ public class InterpreterHookRegistry { static final String GLOBAL_KEY = "_GLOBAL_"; @@ -34,7 +34,6 @@ public class InterpreterHookRegistry { // Scope (noteId/global scope) -> (ClassName -> (EventType -> Hook Code)) private Map<String, Map<String, Map<String, String>>> registry = new HashMap<>(); - /** * Adds a note to the registry * @@ -47,7 +46,7 @@ public class InterpreterHookRegistry { } } } - + /** * Adds a className to the registry * @@ -62,7 +61,7 @@ public class InterpreterHookRegistry { } } } - + /** * Register a hook for a specific event. * @@ -71,8 +70,8 @@ public class InterpreterHookRegistry { * @param event hook event (see constants defined in this class) * @param cmd Code to be executed by the interpreter */ - public void register(String noteId, String className, - String event, String cmd) throws InvalidHookException { + public void register(String noteId, String className, String event, String cmd) + throws InvalidHookException { synchronized (registry) { if (!HookType.ValidEvents.contains(event)) { throw new InvalidHookException("event " + event + " is not valid hook event"); @@ -84,7 +83,7 @@ public class InterpreterHookRegistry { registry.get(noteId).get(className).put(event, cmd); } } - + /** * Unregister a hook for a specific event. * @@ -101,7 +100,7 @@ public class InterpreterHookRegistry { registry.get(noteId).get(className).remove(event); } } - + /** * Get a hook for a specific event. * @@ -118,18 +117,16 @@ public class InterpreterHookRegistry { return registry.get(noteId).get(className).get(event); } } - - /** - * Container for hook event type constants - */ + + /** Container for hook event type constants */ public enum HookType { // Execute the hook code PRIOR to main paragraph code execution PRE_EXEC("pre_exec"), - + // Execute the hook code AFTER main paragraph code execution POST_EXEC("post_exec"), - + // Same as above but reserved for interpreter developers, in order to allow // notebook users to use the above without overwriting registry settings // that are initialized directly in subclasses of Interpreter. @@ -147,11 +144,11 @@ public class InterpreterHookRegistry { } public static Set<String> ValidEvents = new HashSet(); + static { for (HookType type : values()) { ValidEvents.add(type.getName()); } } } - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java index 0c01d97..632d1a0 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOption.java @@ -21,14 +21,12 @@ import java.util.ArrayList; import java.util.List; import org.apache.zeppelin.conf.ZeppelinConfiguration; -/** - * - */ +/** */ public class InterpreterOption { public static final transient String SHARED = "shared"; public static final transient String SCOPED = "scoped"; public static final transient String ISOLATED = "isolated"; - private static ZeppelinConfiguration conf = ZeppelinConfiguration.create(); + private static ZeppelinConfiguration conf = ZeppelinConfiguration.create(); // always set it as true, keep this field just for backward compatibility boolean remote = true; @@ -86,8 +84,7 @@ public class InterpreterOption { isUserImpersonate = userImpersonate; } - public InterpreterOption() { - } + public InterpreterOption() {} public InterpreterOption(String perUser, String perNote) { if (perUser == null) { @@ -110,8 +107,8 @@ public class InterpreterOption { option.perUser = other.perUser; option.isExistingProcess = other.isExistingProcess; option.setPermission = other.setPermission; - option.owners = (null == other.owners) ? - new ArrayList<String>() : new ArrayList<>(other.owners); + option.owners = + (null == other.owners) ? new ArrayList<String>() : new ArrayList<>(other.owners); return option; } @@ -124,7 +121,6 @@ public class InterpreterOption { return port; } - public boolean perUserShared() { return SHARED.equals(perUser); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java index 8853227..faae180 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutput.java @@ -16,10 +16,6 @@ */ package org.apache.zeppelin.interpreter; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -28,10 +24,12 @@ import java.net.URL; import java.util.Collections; import java.util.LinkedList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * InterpreterOutput is OutputStream that supposed to print content on notebook - * in addition to InterpreterResult which used to return from Interpreter.interpret(). + * InterpreterOutput is OutputStream that supposed to print content on notebook in addition to + * InterpreterResult which used to return from Interpreter.interpret(). */ public class InterpreterOutput extends OutputStream { Logger logger = LoggerFactory.getLogger(InterpreterOutput.class); @@ -61,8 +59,8 @@ public class InterpreterOutput extends OutputStream { clear(); } - public InterpreterOutput(InterpreterOutputListener flushListener, - InterpreterOutputChangeListener listener) + public InterpreterOutput( + InterpreterOutputListener flushListener, InterpreterOutputChangeListener listener) throws IOException { this.flushListener = flushListener; this.changeListener = listener; @@ -168,7 +166,6 @@ public class InterpreterOutput extends OutputStream { } } - int previousChar = 0; boolean startOfTheNewLine = true; boolean firstCharIsPercentSign = false; @@ -190,8 +187,12 @@ public class InterpreterOutput extends OutputStream { InterpreterResult.Type type = currentOut.getType(); if (type == InterpreterResult.Type.TEXT || type == InterpreterResult.Type.TABLE) { setType(InterpreterResult.Type.HTML); - getCurrentOutput().write(ResultMessages.getExceedsLimitSizeMessage(limit, - "ZEPPELIN_INTERPRETER_OUTPUT_LIMIT").getData().getBytes()); + getCurrentOutput() + .write( + ResultMessages.getExceedsLimitSizeMessage( + limit, "ZEPPELIN_INTERPRETER_OUTPUT_LIMIT") + .getData() + .getBytes()); truncated = true; return; } @@ -275,12 +276,12 @@ public class InterpreterOutput extends OutputStream { } @Override - public void write(byte [] b) throws IOException { + public void write(byte[] b) throws IOException { write(b, 0, b.length); } @Override - public void write(byte [] b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { for (int i = off; i < len; i++) { write(b[i]); } @@ -288,6 +289,7 @@ public class InterpreterOutput extends OutputStream { /** * In dev mode, it monitors file and update ZeppelinServer + * * @param file * @throws IOException */ @@ -307,6 +309,7 @@ public class InterpreterOutput extends OutputStream { /** * write contents in the resource file in the classpath + * * @param url * @throws IOException */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java index 44bcd7c..19e179d 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeListener.java @@ -18,10 +18,7 @@ package org.apache.zeppelin.interpreter; import java.io.File; -/** - * InterpreterOutputChangeListener - */ +/** InterpreterOutputChangeListener */ public interface InterpreterOutputChangeListener { void fileChanged(File file); - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java index 1cb9c23..965cc0c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputChangeWatcher.java @@ -20,6 +20,7 @@ import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; import static java.nio.file.StandardWatchEventKinds.OVERFLOW; + import java.io.File; import java.io.IOException; import java.nio.file.ClosedWatchServiceException; @@ -33,13 +34,10 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.TimeUnit; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** - * Watch the change for the development mode support - */ +/** Watch the change for the development mode support */ public class InterpreterOutputChangeWatcher extends Thread { Logger logger = LoggerFactory.getLogger(InterpreterOutputChangeWatcher.class); @@ -80,7 +78,6 @@ public class InterpreterOutputChangeWatcher extends Thread { synchronized (watchKeys) { for (WatchKey key : watchKeys.keySet()) { key.cancel(); - } watchKeys.clear(); watchFiles.clear(); http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java index a176ef2..79cbbab 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterOutputListener.java @@ -16,17 +16,14 @@ */ package org.apache.zeppelin.interpreter; -/** - * Listen InterpreterOutput buffer flush - */ +/** Listen InterpreterOutput buffer flush */ public interface InterpreterOutputListener { - /** - * update all message outputs - */ + /** update all message outputs */ void onUpdateAll(InterpreterOutput out); /** * called when newline is detected + * * @param index * @param out * @param line @@ -35,6 +32,7 @@ public interface InterpreterOutputListener { /** * when entire output is updated. eg) after detecting new display system + * * @param index * @param out */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 92cf3a8..053acfa 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -17,9 +17,7 @@ package org.apache.zeppelin.interpreter; -/** - * Property for instance of interpreter - */ +/** Property for instance of interpreter */ public class InterpreterProperty { private String name; private Object value; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index aa1a0b2..7ec0d27 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -20,26 +20,23 @@ package org.apache.zeppelin.interpreter; import java.util.HashMap; import java.util.Map; -/** - * InterpreterPropertyBuilder - */ +/** InterpreterPropertyBuilder */ public class InterpreterPropertyBuilder { Map<String, DefaultInterpreterProperty> properties = new HashMap<>(); - public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ - properties.put(name, - new DefaultInterpreterProperty(defaultValue, description)); + public InterpreterPropertyBuilder add(String name, String defaultValue, String description) { + properties.put(name, new DefaultInterpreterProperty(defaultValue, description)); return this; } - public InterpreterPropertyBuilder add(String name, String envName, String propertyName, - String defaultValue, String description){ - properties.put(name, - new DefaultInterpreterProperty(envName, propertyName, defaultValue, description)); + public InterpreterPropertyBuilder add( + String name, String envName, String propertyName, String defaultValue, String description) { + properties.put( + name, new DefaultInterpreterProperty(envName, propertyName, defaultValue, description)); return this; } - public Map<String, DefaultInterpreterProperty> build(){ + public Map<String, DefaultInterpreterProperty> build() { return properties; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java index 6bbc39d..bb45a1e 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java @@ -20,11 +20,8 @@ package org.apache.zeppelin.interpreter; import java.util.ArrayList; import java.util.List; -/** - * Types of interpreter properties - */ +/** Types of interpreter properties */ public enum InterpreterPropertyType { - TEXTAREA("textarea"), STRING("string"), NUMBER("number"), http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java index 255b21e..804046a 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResult.java @@ -18,25 +18,20 @@ package org.apache.zeppelin.interpreter; import com.google.gson.Gson; -import org.apache.zeppelin.common.JsonSerializable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.IOException; import java.io.Serializable; import java.util.LinkedList; import java.util.List; +import org.apache.zeppelin.common.JsonSerializable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -/** - * Interpreter result template. - */ +/** Interpreter result template. */ public class InterpreterResult implements Serializable, JsonSerializable { transient Logger logger = LoggerFactory.getLogger(InterpreterResult.class); private static final Gson gson = new Gson(); - /** - * Type of result after code execution. - */ + /** Type of result after code execution. */ public enum Code { SUCCESS, INCOMPLETE, @@ -44,9 +39,7 @@ public class InterpreterResult implements Serializable, JsonSerializable { KEEP_PREVIOUS_RESULT } - /** - * Type of Data. - */ + /** Type of Data. */ public enum Type { TEXT, HTML, @@ -82,6 +75,7 @@ public class InterpreterResult implements Serializable, JsonSerializable { /** * Automatically detect %[display_system] directives + * * @param msg */ public void add(String msg) { @@ -94,7 +88,6 @@ public class InterpreterResult implements Serializable, JsonSerializable { } catch (IOException e) { logger.error(e.getMessage(), e); } - } public void add(Type type, String data) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java index f137ca5..370253c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessage.java @@ -18,9 +18,7 @@ package org.apache.zeppelin.interpreter; import java.io.Serializable; -/** - * Interpreter result message - */ +/** Interpreter result message */ public class InterpreterResultMessage implements Serializable { InterpreterResult.Type type; String data; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java index 8758c98..436ca4a 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutput.java @@ -16,9 +16,6 @@ */ package org.apache.zeppelin.interpreter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; @@ -28,10 +25,10 @@ import java.io.OutputStream; import java.net.URL; import java.util.LinkedList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -/** - * InterpreterMessageOutputStream - */ +/** InterpreterMessageOutputStream */ public class InterpreterResultMessageOutput extends OutputStream { Logger logger = LoggerFactory.getLogger(InterpreterResultMessageOutput.class); private final int NEW_LINE_CHAR = '\n'; @@ -46,8 +43,7 @@ public class InterpreterResultMessageOutput extends OutputStream { private boolean firstWrite = true; public InterpreterResultMessageOutput( - InterpreterResult.Type type, - InterpreterResultMessageOutputListener listener) { + InterpreterResult.Type type, InterpreterResultMessageOutputListener listener) { this.type = type; this.flushListener = listener; } @@ -55,7 +51,8 @@ public class InterpreterResultMessageOutput extends OutputStream { public InterpreterResultMessageOutput( InterpreterResult.Type type, InterpreterResultMessageOutputListener flushListener, - InterpreterOutputChangeListener listener) throws IOException { + InterpreterOutputChangeListener listener) + throws IOException { this.type = type; this.flushListener = flushListener; watcher = new InterpreterOutputChangeWatcher(listener); @@ -109,12 +106,12 @@ public class InterpreterResultMessageOutput extends OutputStream { } @Override - public void write(byte [] b) throws IOException { + public void write(byte[] b) throws IOException { write(b, 0, b.length); } @Override - public void write(byte [] b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { synchronized (outList) { for (int i = off; i < len; i++) { write(b[i]); @@ -124,6 +121,7 @@ public class InterpreterResultMessageOutput extends OutputStream { /** * In dev mode, it monitors file and update ZeppelinServer + * * @param file * @throws IOException */ @@ -140,6 +138,7 @@ public class InterpreterResultMessageOutput extends OutputStream { /** * write contents in the resource file in the classpath + * * @param url * @throws IOException */ http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java index 7f14a3e..5b56e61 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterResultMessageOutputListener.java @@ -16,18 +16,15 @@ */ package org.apache.zeppelin.interpreter; -/** - * InterpreterResultMessage update events - */ +/** InterpreterResultMessage update events */ public interface InterpreterResultMessageOutputListener { /** * called when newline is detected + * * @param line */ void onAppend(InterpreterResultMessageOutput out, byte[] line); - /** - * when entire output is updated. eg) after detecting new display system - */ + /** when entire output is updated. eg) after detecting new display system */ void onUpdate(InterpreterResultMessageOutput out); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java index e60ada7..982823a 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterRunner.java @@ -2,19 +2,16 @@ package org.apache.zeppelin.interpreter; import com.google.gson.annotations.SerializedName; -/** - * Interpreter runner path - */ +/** Interpreter runner path */ public class InterpreterRunner { @SerializedName("linux") private String linuxPath; + @SerializedName("win") private String winPath; - public InterpreterRunner() { - - } + public InterpreterRunner() {} public InterpreterRunner(String linuxPath, String winPath) { this.linuxPath = linuxPath; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java index c3d3b9e..49ea68d 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterUtils.java @@ -1,27 +1,22 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. You may obtain a + * copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * <p>http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and + * <p>Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.zeppelin.interpreter; import java.lang.reflect.InvocationTargetException; -/** - * Interpreter utility functions - */ +/** Interpreter utility functions */ public class InterpreterUtils { public static String getMostRelevantMessage(Exception ex) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java index 9b44726..3d7b308 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InvalidHookException.java @@ -15,12 +15,9 @@ * limitations under the License. */ - package org.apache.zeppelin.interpreter; -/** - * Exception for invalid hook - */ +/** Exception for invalid hook */ public class InvalidHookException extends Exception { public InvalidHookException(String message) { http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java index 4da5ef5..57a4e69 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/KerberosInterpreter.java @@ -31,18 +31,14 @@ import org.slf4j.LoggerFactory; /** * Interpreter wrapper for Kerberos initialization * - * runKerberosLogin() method you need to implement that determine how should this interpeter do a - * kinit for this interpreter. - * isKerboseEnabled() method needs to implement which determines if the kerberos is enabled for that - * interpreter. - * startKerberosLoginThread() needs to be called inside the open() and - * shutdownExecutorService() inside close(). + * <p>runKerberosLogin() method you need to implement that determine how should this interpeter do a + * kinit for this interpreter. isKerboseEnabled() method needs to implement which determines if the + * kerberos is enabled for that interpreter. startKerberosLoginThread() needs to be called inside + * the open() and shutdownExecutorService() inside close(). * - * - * Environment variables defined in zeppelin-env.sh - * KERBEROS_REFRESH_INTERVAL controls the refresh interval for Kerberos ticket. The default value - * is 1d. - * KINIT_FAIL_THRESHOLD controls how many times should kinit retry. The default value is 5. + * <p>Environment variables defined in zeppelin-env.sh KERBEROS_REFRESH_INTERVAL controls the + * refresh interval for Kerberos ticket. The default value is 1d. KINIT_FAIL_THRESHOLD controls how + * many times should kinit retry. The default value is 5. */ public abstract class KerberosInterpreter extends Interpreter { @@ -75,15 +71,18 @@ public abstract class KerberosInterpreter extends Interpreter { private Long getKerberosRefreshInterval() { Long refreshInterval; String refreshIntervalString = "1d"; - //defined in zeppelin-env.sh, if not initialized then the default value is one day. + // defined in zeppelin-env.sh, if not initialized then the default value is one day. if (System.getenv("KERBEROS_REFRESH_INTERVAL") != null) { refreshIntervalString = System.getenv("KERBEROS_REFRESH_INTERVAL"); } try { refreshInterval = getTimeAsMs(refreshIntervalString); } catch (IllegalArgumentException e) { - logger.error("Cannot get time in MS for the given string, " + refreshIntervalString - + " defaulting to 1d ", e); + logger.error( + "Cannot get time in MS for the given string, " + + refreshIntervalString + + " defaulting to 1d ", + e); refreshInterval = getTimeAsMs("1d"); } @@ -92,13 +91,17 @@ public abstract class KerberosInterpreter extends Interpreter { private Integer kinitFailThreshold() { Integer kinitFailThreshold = 5; - //defined in zeppelin-env.sh, if not initialized then the default value is 5. + // defined in zeppelin-env.sh, if not initialized then the default value is 5. if (System.getenv("KINIT_FAIL_THRESHOLD") != null) { try { kinitFailThreshold = new Integer(System.getenv("KINIT_FAIL_THRESHOLD")); } catch (Exception e) { - logger.error("Cannot get integer value from the given string, " + System - .getenv("KINIT_FAIL_THRESHOLD") + " defaulting to " + kinitFailThreshold, e); + logger.error( + "Cannot get integer value from the given string, " + + System.getenv("KINIT_FAIL_THRESHOLD") + + " defaulting to " + + kinitFailThreshold, + e); } } return kinitFailThreshold; @@ -122,36 +125,39 @@ public abstract class KerberosInterpreter extends Interpreter { throw new IllegalArgumentException("Invalid suffix: \"" + suffix + "\""); } - return TimeUnit.MILLISECONDS.convert(val, - suffix != null ? Constants.TIME_SUFFIXES.get(suffix) : TimeUnit.MILLISECONDS); + return TimeUnit.MILLISECONDS.convert( + val, suffix != null ? Constants.TIME_SUFFIXES.get(suffix) : TimeUnit.MILLISECONDS); } private ScheduledExecutorService startKerberosLoginThread() { scheduledExecutorService = Executors.newScheduledThreadPool(1); - scheduledExecutorService.submit(new Callable() { - public Object call() throws Exception { - - if (runKerberosLogin()) { - logger.info("Ran runKerberosLogin command successfully."); - kinitFailCount = 0; - // schedule another kinit run with a fixed delay. - scheduledExecutorService - .schedule(this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); - } else { - kinitFailCount++; - logger.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); - // schedule another retry at once or close the interpreter if too many times kinit fails - if (kinitFailCount >= kinitFailThreshold()) { - logger.error("runKerberosLogin failed for max attempts, calling close interpreter."); - close(); - } else { - scheduledExecutorService.submit(this); + scheduledExecutorService.submit( + new Callable() { + public Object call() throws Exception { + + if (runKerberosLogin()) { + logger.info("Ran runKerberosLogin command successfully."); + kinitFailCount = 0; + // schedule another kinit run with a fixed delay. + scheduledExecutorService.schedule( + this, getKerberosRefreshInterval(), TimeUnit.MILLISECONDS); + } else { + kinitFailCount++; + logger.info("runKerberosLogin failed for " + kinitFailCount + " time(s)."); + // schedule another retry at once or close the interpreter if too many times kinit + // fails + if (kinitFailCount >= kinitFailThreshold()) { + logger.error( + "runKerberosLogin failed for max attempts, calling close interpreter."); + close(); + } else { + scheduledExecutorService.submit(this); + } + } + return null; } - } - return null; - } - }); + }); return scheduledExecutorService; } @@ -161,5 +167,4 @@ public abstract class KerberosInterpreter extends Interpreter { scheduledExecutorService.shutdown(); } } - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java index 7581e67..3303751 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/LazyOpenInterpreter.java @@ -20,16 +20,11 @@ package org.apache.zeppelin.interpreter; import java.net.URL; import java.util.List; import java.util.Properties; - import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.scheduler.Scheduler; -/** - * Interpreter wrapper for lazy initialization - */ -public class LazyOpenInterpreter - extends Interpreter - implements WrappedInterpreter { +/** Interpreter wrapper for lazy initialization */ +public class LazyOpenInterpreter extends Interpreter implements WrappedInterpreter { private Interpreter intp; volatile boolean opened = false; @@ -132,8 +127,8 @@ public class LazyOpenInterpreter } @Override - public List<InterpreterCompletion> completion(String buf, int cursor, - InterpreterContext interpreterContext) throws InterpreterException { + public List<InterpreterCompletion> completion( + String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { open(); List completion = intp.completion(buf, cursor, interpreterContext); return completion; @@ -155,12 +150,12 @@ public class LazyOpenInterpreter } @Override - public URL [] getClassloaderUrls() { + public URL[] getClassloaderUrls() { return intp.getClassloaderUrls(); } @Override - public void setClassloaderUrls(URL [] urls) { + public void setClassloaderUrls(URL[] urls) { intp.setClassloaderUrls(urls); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java index bf96a09..1511138 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/RemoteZeppelinServerResource.java @@ -20,16 +20,12 @@ package org.apache.zeppelin.interpreter; import com.google.gson.Gson; import org.apache.zeppelin.common.JsonSerializable; -/** - * Remote Zeppelin Server Resource - */ +/** Remote Zeppelin Server Resource */ public class RemoteZeppelinServerResource implements JsonSerializable { private static final Gson gson = new Gson(); - /** - * Resource Type for Zeppelin Server - */ - public enum Type{ + /** Resource Type for Zeppelin Server */ + public enum Type { PARAGRAPH_RUNNERS } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java index d32299e..2fa3de8 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/ResultMessages.java @@ -17,30 +17,32 @@ package org.apache.zeppelin.interpreter; -/** - * - */ +/** */ public class ResultMessages { public static final String EXCEEDS_LIMIT_ROWS = "<strong>Output is truncated</strong> to %s rows. Learn more about <strong>%s</strong>"; public static final String EXCEEDS_LIMIT_SIZE = "<strong>Output is truncated</strong> to %s bytes. Learn more about <strong>%s</strong>"; public static final String EXCEEDS_LIMIT = - "<div class=\"result-alert alert-warning\" role=\"alert\">" + - "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + - "<span aria-hidden=\"true\">×</span></button>" + - "%s" + - "</div>"; + "<div class=\"result-alert alert-warning\" role=\"alert\">" + + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\">" + + "<span aria-hidden=\"true\">×</span></button>" + + "%s" + + "</div>"; public static InterpreterResultMessage getExceedsLimitRowsMessage(int amount, String variable) { - InterpreterResultMessage message = new InterpreterResultMessage(InterpreterResult.Type.HTML, - String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_ROWS, amount, variable))); + InterpreterResultMessage message = + new InterpreterResultMessage( + InterpreterResult.Type.HTML, + String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_ROWS, amount, variable))); return message; } public static InterpreterResultMessage getExceedsLimitSizeMessage(int amount, String variable) { - InterpreterResultMessage message = new InterpreterResultMessage(InterpreterResult.Type.HTML, - String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_SIZE, amount, variable))); + InterpreterResultMessage message = + new InterpreterResultMessage( + InterpreterResult.Type.HTML, + String.format(EXCEEDS_LIMIT, String.format(EXCEEDS_LIMIT_SIZE, amount, variable))); return message; } } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java index 040b546..39785cb 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/WrappedInterpreter.java @@ -17,9 +17,7 @@ package org.apache.zeppelin.interpreter; -/** - * WrappedInterpreter - */ +/** WrappedInterpreter */ public interface WrappedInterpreter { Interpreter getInnerInterpreter(); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java index df1b9a3..e12d8bf 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/graph/GraphResult.java @@ -17,52 +17,40 @@ package org.apache.zeppelin.interpreter.graph; +import com.google.gson.Gson; import java.util.Collection; import java.util.Map; import java.util.Set; - import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.tabledata.Node; import org.apache.zeppelin.tabledata.Relationship; -import com.google.gson.Gson; - -/** - * The intepreter result template for Networks - * - */ +/** The intepreter result template for Networks */ public class GraphResult extends InterpreterResult { - /** - * The Graph structure parsed from the front-end - * - */ + /** The Graph structure parsed from the front-end */ public static class Graph { private Collection<Node> nodes; - + private Collection<Relationship> edges; - - /** - * The node types in the whole graph, and the related colors - * - */ + + /** The node types in the whole graph, and the related colors */ private Map<String, String> labels; - - /** - * The relationship types in the whole graph - * - */ + + /** The relationship types in the whole graph */ private Set<String> types; - /** - * Is a directed graph - */ + /** Is a directed graph */ private boolean directed; - + public Graph() {} - public Graph(Collection<Node> nodes, Collection<Relationship> edges, - Map<String, String> labels, Set<String> types, boolean directed) { + public Graph( + Collection<Node> nodes, + Collection<Relationship> edges, + Map<String, String> labels, + Set<String> types, + boolean directed) { super(); this.setNodes(nodes); this.setEdges(edges); @@ -98,7 +86,7 @@ public class GraphResult extends InterpreterResult { public Set<String> getTypes() { return types; } - + public void setTypes(Set<String> types) { this.types = types; } @@ -110,13 +98,11 @@ public class GraphResult extends InterpreterResult { public void setDirected(boolean directed) { this.directed = directed; } - } - + private static final Gson gson = new Gson(); public GraphResult(Code code, Graph graphObject) { super(code, Type.NETWORK, gson.toJson(graphObject)); } - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java index 136d866..6b61f53 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLaunchContext.java @@ -17,14 +17,11 @@ package org.apache.zeppelin.interpreter.launcher; +import java.util.Properties; import org.apache.zeppelin.interpreter.InterpreterOption; import org.apache.zeppelin.interpreter.InterpreterRunner; -import java.util.Properties; - -/** - * Context class for Interpreter Launch - */ +/** Context class for Interpreter Launch */ public class InterpreterLaunchContext { private Properties properties; @@ -38,16 +35,17 @@ public class InterpreterLaunchContext { private int zeppelinServerRPCPort; private String zeppelinServerHost; - public InterpreterLaunchContext(Properties properties, - InterpreterOption option, - InterpreterRunner runner, - String userName, - String interpreterGroupId, - String interpreterSettingId, - String interpreterSettingGroup, - String interpreterSettingName, - int zeppelinServerRPCPort, - String zeppelinServerHost) { + public InterpreterLaunchContext( + Properties properties, + InterpreterOption option, + InterpreterRunner runner, + String userName, + String interpreterGroupId, + String interpreterSettingId, + String interpreterSettingGroup, + String interpreterSettingName, + int zeppelinServerRPCPort, + String zeppelinServerHost) { this.properties = properties; this.option = option; this.runner = runner; http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java index 30cf995..dfec532 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/launcher/InterpreterLauncher.java @@ -17,15 +17,12 @@ package org.apache.zeppelin.interpreter.launcher; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.interpreter.recovery.RecoveryStorage; - import java.io.IOException; import java.util.Properties; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.apache.zeppelin.interpreter.recovery.RecoveryStorage; -/** - * Component to Launch interpreter process. - */ +/** Component to Launch interpreter process. */ public abstract class InterpreterLauncher { protected ZeppelinConfiguration zConf; @@ -42,8 +39,11 @@ public abstract class InterpreterLauncher { zConf.getInt(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT); if (properties.containsKey( ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName())) { - connectTimeout = Integer.parseInt(properties.getProperty( - ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT.getVarName())); + connectTimeout = + Integer.parseInt( + properties.getProperty( + ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT + .getVarName())); } return connectTimeout; } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java index 8bbe830..3f64700 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/recovery/RecoveryStorage.java @@ -17,17 +17,12 @@ package org.apache.zeppelin.interpreter.recovery; -import org.apache.zeppelin.conf.ZeppelinConfiguration; -import org.apache.zeppelin.interpreter.launcher.InterpreterClient; - import java.io.IOException; import java.util.Map; +import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.apache.zeppelin.interpreter.launcher.InterpreterClient; - -/** - * Interface for storing interpreter process recovery metadata. - * - */ +/** Interface for storing interpreter process recovery metadata. */ public abstract class RecoveryStorage { protected ZeppelinConfiguration zConf; @@ -39,6 +34,7 @@ public abstract class RecoveryStorage { /** * Update RecoveryStorage when new InterpreterClient is started + * * @param client * @throws IOException */ @@ -46,13 +42,13 @@ public abstract class RecoveryStorage { /** * Update RecoveryStorage when InterpreterClient is stopped + * * @param client * @throws IOException */ public abstract void onInterpreterClientStop(InterpreterClient client) throws IOException; /** - * * It is only called when Zeppelin Server is started. * * @return @@ -60,7 +56,6 @@ public abstract class RecoveryStorage { */ public abstract Map<String, InterpreterClient> restore() throws IOException; - /** * It is called after constructor * http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java index aaf3d7b..623ce87 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/InvokeResourceMethodEventMessage.java @@ -20,9 +20,7 @@ import com.google.gson.Gson; import org.apache.zeppelin.common.JsonSerializable; import org.apache.zeppelin.resource.ResourceId; -/** - * message payload to invoke method of resource in the resourcepool - */ +/** message payload to invoke method of resource in the resourcepool */ public class InvokeResourceMethodEventMessage implements JsonSerializable { private static final Gson gson = new Gson(); @@ -37,8 +35,7 @@ public class InvokeResourceMethodEventMessage implements JsonSerializable { String methodName, Class[] paramtypes, Object[] params, - String returnResourceName - ) { + String returnResourceName) { this.resourceId = resourceId; this.methodName = methodName; if (paramtypes != null) { @@ -54,12 +51,12 @@ public class InvokeResourceMethodEventMessage implements JsonSerializable { this.returnResourceName = returnResourceName; } - public Class [] getParamTypes() throws ClassNotFoundException { + public Class[] getParamTypes() throws ClassNotFoundException { if (paramClassnames == null) { return null; } - Class [] types = new Class[paramClassnames.length]; + Class[] types = new Class[paramClassnames.length]; for (int i = 0; i < paramClassnames.length; i++) { types[i] = this.getClass().getClassLoader().loadClass(paramClassnames[i]); } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java index 287095d..37a0c6a 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterEventClient.java @@ -17,6 +17,11 @@ package org.apache.zeppelin.interpreter.remote; import com.google.gson.Gson; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.thrift.TException; import org.apache.zeppelin.display.AngularObject; import org.apache.zeppelin.display.AngularObjectRegistryListener; @@ -38,18 +43,12 @@ import org.apache.zeppelin.resource.ResourceSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** - * This class is used to communicate with ZeppelinServer via thrift. - * All the methods are synchronized because thrift client is not thread safe. + * This class is used to communicate with ZeppelinServer via thrift. All the methods are + * synchronized because thrift client is not thread safe. */ -public class RemoteInterpreterEventClient implements ResourcePoolConnector, - AngularObjectRegistryListener { +public class RemoteInterpreterEventClient + implements ResourcePoolConnector, AngularObjectRegistryListener { private final Logger LOGGER = LoggerFactory.getLogger(RemoteInterpreterEventClient.class); private final Gson gson = new Gson(); @@ -109,10 +108,7 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, */ @Override public synchronized Object invokeMethod( - ResourceId resourceId, - String methodName, - Class[] paramTypes, - Object[] params) { + ResourceId resourceId, String methodName, Class[] paramTypes, Object[] params) { LOGGER.debug("Request Invoke method {} of Resource {}", methodName, resourceId.getName()); return null; @@ -215,8 +211,11 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, } public synchronized void onInterpreterOutputUpdate( - String noteId, String paragraphId, int outputIndex, - InterpreterResult.Type type, String output) { + String noteId, + String paragraphId, + int outputIndex, + InterpreterResult.Type type, + String output) { try { intpEventServiceClient.updateOutput( new OutputUpdateEvent(noteId, paragraphId, outputIndex, type.name(), output, null)); @@ -236,7 +235,7 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, } private List<org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage> - convertToThrift(List<InterpreterResultMessage> messages) { + convertToThrift(List<InterpreterResultMessage> messages) { List<org.apache.zeppelin.interpreter.thrift.RemoteInterpreterResultMessage> thriftMessages = new ArrayList<>(); for (InterpreterResultMessage message : messages) { @@ -247,10 +246,11 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, return thriftMessages; } - public synchronized void runParagraphs(String noteId, - List<String> paragraphIds, - List<Integer> paragraphIndices, - String curParagraphId) { + public synchronized void runParagraphs( + String noteId, + List<String> paragraphIds, + List<Integer> paragraphIndices, + String curParagraphId) { RunParagraphsEvent event = new RunParagraphsEvent(noteId, paragraphIds, paragraphIndices, curParagraphId); try { @@ -271,10 +271,13 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, } } - public synchronized void onAppOutputUpdate( - String noteId, String paragraphId, int index, String appId, - InterpreterResult.Type type, String output) { + String noteId, + String paragraphId, + int index, + String appId, + InterpreterResult.Type type, + String output) { AppOutputUpdateEvent event = new AppOutputUpdateEvent(noteId, paragraphId, appId, index, type.name(), output); try { @@ -284,8 +287,8 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, } } - public synchronized void onAppStatusUpdate(String noteId, String paragraphId, String appId, - String status) { + public synchronized void onAppStatusUpdate( + String noteId, String paragraphId, String appId, String status) { AppStatusUpdateEvent event = new AppStatusUpdateEvent(noteId, paragraphId, appId, status); try { intpEventServiceClient.updateAppStatus(event); @@ -321,8 +324,8 @@ public class RemoteInterpreterEventClient implements ResourcePoolConnector, } @Override - public synchronized void onRemove(String interpreterGroupId, String name, String noteId, - String paragraphId) { + public synchronized void onRemove( + String interpreterGroupId, String name, String noteId, String paragraphId) { try { intpEventServiceClient.removeAngularObject(intpGroupId, noteId, paragraphId, name); } catch (TException e) {
