http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java index 1188651..11e6bdb 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterServer.java @@ -19,22 +19,6 @@ package org.apache.zeppelin.interpreter.remote; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import org.apache.thrift.TException; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TProtocol; @@ -89,8 +73,29 @@ import org.apache.zeppelin.user.AuthenticationInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -/** Entry point for Interpreter process. Accepting thrift connections from ZeppelinServer. */ -public class RemoteInterpreterServer extends Thread implements RemoteInterpreterService.Iface { +import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +/** + * Entry point for Interpreter process. + * Accepting thrift connections from ZeppelinServer. + */ +public class RemoteInterpreterServer extends Thread + implements RemoteInterpreterService.Iface { private static Logger logger = LoggerFactory.getLogger(RemoteInterpreterServer.class); @@ -123,21 +128,19 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter private boolean isTest; - public RemoteInterpreterServer( - String intpEventServerHost, - int intpEventServerPort, - String interpreterGroupId, - String portRange) + public RemoteInterpreterServer(String intpEventServerHost, + int intpEventServerPort, + String interpreterGroupId, + String portRange) throws IOException, TTransportException { this(intpEventServerHost, intpEventServerPort, portRange, interpreterGroupId, false); } - public RemoteInterpreterServer( - String intpEventServerHost, - int intpEventServerPort, - String portRange, - String interpreterGroupId, - boolean isTest) + public RemoteInterpreterServer(String intpEventServerHost, + int intpEventServerPort, + String portRange, + String interpreterGroupId, + boolean isTest) throws TTransportException, IOException { if (null != intpEventServerHost) { this.intpEventServerHost = intpEventServerHost; @@ -166,8 +169,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter this.host = RemoteInterpreterUtils.findAvailableHostAddress(); logger.info("Launching ThriftServer at " + this.host + ":" + this.port); } - server = - new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor)); + server = new TThreadPoolServer( + new TThreadPoolServer.Args(serverTransport).processor(processor)); logger.info("Starting remote interpreter server on port {}", port); remoteWorksResponsePool = Collections.synchronizedMap(new HashMap<String, Object>()); } @@ -175,36 +178,34 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter @Override public void run() { if (null != intpEventServerHost && !isTest) { - new Thread( - new Runnable() { - boolean interrupted = false; - - @Override - public void run() { - while (!interrupted && !server.isServing()) { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - interrupted = true; - } - } - - if (!interrupted) { - RegisterInfo registerInfo = new RegisterInfo(host, port, interpreterGroupId); - try { - intpEventServiceClient.registerInterpreterProcess(registerInfo); - } catch (TException e) { - logger.error("Error while registering interpreter: {}", registerInfo, e); - try { - shutdown(); - } catch (TException e1) { - logger.warn("Exception occurs while shutting down", e1); - } - } - } - } - }) - .start(); + new Thread(new Runnable() { + boolean interrupted = false; + + @Override + public void run() { + while (!interrupted && !server.isServing()) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + interrupted = true; + } + } + + if (!interrupted) { + RegisterInfo registerInfo = new RegisterInfo(host, port, interpreterGroupId); + try { + intpEventServiceClient.registerInterpreterProcess(registerInfo); + } catch (TException e) { + logger.error("Error while registering interpreter: {}", registerInfo, e); + try { + shutdown(); + } catch (TException e1) { + logger.warn("Exception occurs while shutting down", e1); + } + } + } + } + }).start(); } server.serve(); } @@ -231,8 +232,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter // this case, need to force kill the process long startTime = System.currentTimeMillis(); - while (System.currentTimeMillis() - startTime < DEFAULT_SHUTDOWN_TIMEOUT - && server.isServing()) { + while (System.currentTimeMillis() - startTime < DEFAULT_SHUTDOWN_TIMEOUT && + server.isServing()) { try { Thread.sleep(300); } catch (InterruptedException e) { @@ -257,6 +258,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } } + public static void main(String[] args) throws TTransportException, InterruptedException, IOException { String zeppelinServerHost = null; @@ -279,13 +281,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public void createInterpreter( - String interpreterGroupId, - String sessionId, - String className, - Map<String, String> properties, - String userName) - throws TException { + public void createInterpreter(String interpreterGroupId, String sessionId, String + className, Map<String, String> properties, String userName) throws TException { if (interpreterGroup == null) { interpreterGroup = new InterpreterGroup(interpreterGroupId); angularObjectRegistry = new AngularObjectRegistry(interpreterGroup.getId(), intpEventClient); @@ -298,8 +295,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter String localRepoPath = properties.get("zeppelin.interpreter.localRepo"); if (properties.containsKey("zeppelin.interpreter.output.limit")) { - InterpreterOutput.limit = - Integer.parseInt(properties.get("zeppelin.interpreter.output.limit")); + InterpreterOutput.limit = Integer.parseInt( + properties.get("zeppelin.interpreter.output.limit")); } depLoader = new DependencyResolver(localRepoPath); @@ -313,21 +310,17 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter setSystemProperty(p); Constructor<Interpreter> constructor = - replClass.getConstructor(new Class[] {Properties.class}); + replClass.getConstructor(new Class[]{Properties.class}); Interpreter repl = constructor.newInstance(p); - repl.setClassloaderUrls(new URL[] {}); + repl.setClassloaderUrls(new URL[]{}); logger.info("Instantiate interpreter {}", className); repl.setInterpreterGroup(interpreterGroup); repl.setUserName(userName); interpreterGroup.addInterpreterToSession(new LazyOpenInterpreter(repl), sessionId); - } catch (ClassNotFoundException - | NoSuchMethodException - | SecurityException - | InstantiationException - | IllegalAccessException - | IllegalArgumentException - | InvocationTargetException e) { + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException + | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { logger.error(e.toString(), e); throw new TException(e); } @@ -375,8 +368,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } } } - throw new TException( - new InterpreterException("Interpreter instance " + className + " not found")); + throw new TException(new InterpreterException("Interpreter instance " + + className + " not found")); } @Override @@ -431,9 +424,10 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } } + @Override - public RemoteInterpreterResult interpret( - String sessionId, String className, String st, RemoteInterpreterContext interpreterContext) + public RemoteInterpreterResult interpret(String sessionId, String className, String st, + RemoteInterpreterContext interpreterContext) throws TException { if (logger.isDebugEnabled()) { logger.debug("st:\n{}", st); @@ -444,14 +438,13 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter Scheduler scheduler = intp.getScheduler(); InterpretJobListener jobListener = new InterpretJobListener(); - InterpretJob job = - new InterpretJob( - interpreterContext.getParagraphId(), - "RemoteInterpretJob_" + System.currentTimeMillis(), - jobListener, - intp, - st, - context); + InterpretJob job = new InterpretJob( + interpreterContext.getParagraphId(), + "RemoteInterpretJob_" + System.currentTimeMillis(), + jobListener, + intp, + st, + context); scheduler.submit(job); while (!job.isTerminated()) { @@ -466,18 +459,22 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter progressMap.remove(interpreterContext.getParagraphId()); - InterpreterResult result = (InterpreterResult) job.getReturn(); + InterpreterResult result = (InterpreterResult) job.getReturn(); // in case of job abort in PENDING status, result can be null if (result == null) { result = new InterpreterResult(Code.KEEP_PREVIOUS_RESULT); } - return convert(result, context.getConfig(), context.getGui(), context.getNoteGui()); + return convert(result, + context.getConfig(), + context.getGui(), + context.getNoteGui()); } - + class InterpretJobListener implements JobListener { @Override - public void onProgressUpdate(Job job, int progress) {} + public void onProgressUpdate(Job job, int progress) { + } @Override public void onStatusChange(Job job, Status before, Status after) { @@ -489,6 +486,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter public static class InterpretJob extends Job<InterpreterResult> { + private Interpreter interpreter; private String script; private InterpreterContext context; @@ -527,40 +525,39 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } private void processInterpreterHooks(final String noteId) { - InterpreterHookListener hookListener = - new InterpreterHookListener() { - @Override - public void onPreExecute(String script) { - String cmdDev = interpreter.getHook(noteId, HookType.PRE_EXEC_DEV.getName()); - String cmdUser = interpreter.getHook(noteId, HookType.PRE_EXEC.getName()); - - // User defined hook should be executed before dev hook - List<String> cmds = Arrays.asList(cmdDev, cmdUser); - for (String cmd : cmds) { - if (cmd != null) { - script = cmd + '\n' + script; - } - } - - InterpretJob.this.script = script; + InterpreterHookListener hookListener = new InterpreterHookListener() { + @Override + public void onPreExecute(String script) { + String cmdDev = interpreter.getHook(noteId, HookType.PRE_EXEC_DEV.getName()); + String cmdUser = interpreter.getHook(noteId, HookType.PRE_EXEC.getName()); + + // User defined hook should be executed before dev hook + List<String> cmds = Arrays.asList(cmdDev, cmdUser); + for (String cmd : cmds) { + if (cmd != null) { + script = cmd + '\n' + script; } + } - @Override - public void onPostExecute(String script) { - String cmdDev = interpreter.getHook(noteId, HookType.POST_EXEC_DEV.getName()); - String cmdUser = interpreter.getHook(noteId, HookType.POST_EXEC.getName()); - - // User defined hook should be executed after dev hook - List<String> cmds = Arrays.asList(cmdUser, cmdDev); - for (String cmd : cmds) { - if (cmd != null) { - script += '\n' + cmd; - } - } + InterpretJob.this.script = script; + } + + @Override + public void onPostExecute(String script) { + String cmdDev = interpreter.getHook(noteId, HookType.POST_EXEC_DEV.getName()); + String cmdUser = interpreter.getHook(noteId, HookType.POST_EXEC.getName()); - InterpretJob.this.script = script; + // User defined hook should be executed after dev hook + List<String> cmds = Arrays.asList(cmdUser, cmdDev); + for (String cmd : cmds) { + if (cmd != null) { + script += '\n' + cmd; } - }; + } + + InterpretJob.this.script = script; + } + }; hookListener.onPreExecute(script); hookListener.onPostExecute(script); } @@ -613,13 +610,11 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter if (resultMessages.size() > 0) { int lastMessageIndex = resultMessages.size() - 1; if (resultMessages.get(lastMessageIndex).getType() == InterpreterResult.Type.TABLE) { - context - .getResourcePool() - .put( - context.getNoteId(), - context.getParagraphId(), - WellKnownResourceName.ZeppelinTableResult.toString(), - resultMessages.get(lastMessageIndex)); + context.getResourcePool().put( + context.getNoteId(), + context.getParagraphId(), + WellKnownResourceName.ZeppelinTableResult.toString(), + resultMessages.get(lastMessageIndex)); } } return new InterpreterResult(result.code(), resultMessages); @@ -640,10 +635,11 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } } + @Override - public void cancel( - String sessionId, String className, RemoteInterpreterContext interpreterContext) - throws TException { + public void cancel(String sessionId, + String className, + RemoteInterpreterContext interpreterContext) throws TException { logger.info("cancel {} {}", className, interpreterContext.getParagraphId()); Interpreter intp = getInterpreter(sessionId, className); String jobId = interpreterContext.getParagraphId(); @@ -661,8 +657,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public int getProgress( - String sessionId, String className, RemoteInterpreterContext interpreterContext) + public int getProgress(String sessionId, String className, + RemoteInterpreterContext interpreterContext) throws TException { Integer manuallyProvidedProgress = progressMap.get(interpreterContext.getParagraphId()); if (manuallyProvidedProgress != null) { @@ -670,8 +666,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } else { Interpreter intp = getInterpreter(sessionId, className); if (intp == null) { - throw new TException( - "No interpreter {} existed for session {}".format(className, sessionId)); + throw new TException("No interpreter {} existed for session {}".format( + className, sessionId)); } try { return intp.getProgress(convert(interpreterContext, null)); @@ -681,6 +677,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } } + @Override public String getFormType(String sessionId, String className) throws TException { Interpreter intp = getInterpreter(sessionId, className); @@ -692,12 +689,11 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public List<InterpreterCompletion> completion( - String sessionId, - String className, - String buf, - int cursor, - RemoteInterpreterContext remoteInterpreterContext) + public List<InterpreterCompletion> completion(String sessionId, + String className, + String buf, + int cursor, + RemoteInterpreterContext remoteInterpreterContext) throws TException { Interpreter intp = getInterpreter(sessionId, className); try { @@ -722,8 +718,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter .setLocalProperties(ric.getLocalProperties()) .setAuthenticationInfo(AuthenticationInfo.fromJson(ric.getAuthenticationInfo())) .setGUI(GUI.fromJson(ric.getGui())) - .setConfig( - gson.fromJson(ric.getConfig(), new TypeToken<Map<String, Object>>() {}.getType())) + .setConfig(gson.fromJson(ric.getConfig(), + new TypeToken<Map<String, Object>>() {}.getType())) .setNoteGUI(GUI.fromJson(ric.getNoteGui())) .setAngularObjectRegistry(interpreterGroup.getAngularObjectRegistry()) .setResourcePool(interpreterGroup.getResourcePool()) @@ -733,56 +729,64 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter .build(); } - protected InterpreterOutput createInterpreterOutput( - final String noteId, final String paragraphId) { - return new InterpreterOutput( - new InterpreterOutputListener() { - @Override - public void onUpdateAll(InterpreterOutput out) { - try { - intpEventClient.onInterpreterOutputUpdateAll( - noteId, paragraphId, out.toInterpreterResultMessage()); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - @Override - public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { - String output = new String(line); - logger.debug("Output Append: {}", output); - intpEventClient.onInterpreterOutputAppend(noteId, paragraphId, index, output); - } + protected InterpreterOutput createInterpreterOutput(final String noteId, final String + paragraphId) { + return new InterpreterOutput(new InterpreterOutputListener() { + @Override + public void onUpdateAll(InterpreterOutput out) { + try { + intpEventClient.onInterpreterOutputUpdateAll( + noteId, paragraphId, out.toInterpreterResultMessage()); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + } - @Override - public void onUpdate(int index, InterpreterResultMessageOutput out) { - String output; - try { - output = new String(out.toByteArray()); - logger.debug("Output Update for index {}: {}", index, output); - intpEventClient.onInterpreterOutputUpdate( - noteId, paragraphId, index, out.getType(), output); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - }); + @Override + public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { + String output = new String(line); + logger.debug("Output Append: {}", output); + intpEventClient.onInterpreterOutputAppend( + noteId, paragraphId, index, output); + } + + @Override + public void onUpdate(int index, InterpreterResultMessageOutput out) { + String output; + try { + output = new String(out.toByteArray()); + logger.debug("Output Update for index {}: {}", index, output); + intpEventClient.onInterpreterOutputUpdate( + noteId, paragraphId, index, out.getType(), output); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + } + }); } - private RemoteInterpreterResult convert( - InterpreterResult result, Map<String, Object> config, GUI gui, GUI noteGui) { + private RemoteInterpreterResult convert(InterpreterResult result, + Map<String, Object> config, GUI gui, GUI noteGui) { List<RemoteInterpreterResultMessage> msg = new LinkedList<>(); for (InterpreterResultMessage m : result.message()) { - msg.add(new RemoteInterpreterResultMessage(m.getType().name(), m.getData())); + msg.add(new RemoteInterpreterResultMessage( + m.getType().name(), + m.getData())); } return new RemoteInterpreterResult( - result.code().name(), msg, gson.toJson(config), gui.toJson(), noteGui.toJson()); + result.code().name(), + msg, + gson.toJson(config), + gui.toJson(), + noteGui.toJson()); } @Override - public String getStatus(String sessionId, String jobId) throws TException { + public String getStatus(String sessionId, String jobId) + throws TException { if (interpreterGroup == null) { return Status.UNKNOWN.name(); } @@ -793,7 +797,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter logger.info("getStatus:" + Status.UNKNOWN.name()); return Status.UNKNOWN.name(); } - // TODO(zjffdu) ineffient for loop interpreter and its jobs + //TODO(zjffdu) ineffient for loop interpreter and its jobs for (Interpreter intp : interpreters) { for (Job job : intp.getScheduler().getJobsRunning()) { if (jobId.equals(job.getId())) { @@ -818,7 +822,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter * called when object is updated in client (web) side. * * @param name - * @param noteId noteId where the update issues + * @param noteId noteId where the update issues * @param paragraphId paragraphId where the update issues * @param object * @throws TException @@ -841,7 +845,7 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter Object oldObject = ao.get(); Object value = null; - if (oldObject != null) { // first try with previous object's type + if (oldObject != null) { // first try with previous object's type try { value = gson.fromJson(object, oldObject.getClass()); ao.set(value, false); @@ -855,7 +859,9 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter // Generic java object type for json. if (value == null) { try { - value = gson.fromJson(object, new TypeToken<Map<String, Object>>() {}.getType()); + value = gson.fromJson(object, + new TypeToken<Map<String, Object>>() { + }.getType()); } catch (Exception e) { // it's not a generic json object, too. okay, proceed to threat as a string type logger.debug(e.getMessage(), e); @@ -871,7 +877,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } /** - * When zeppelinserver initiate angular object add. Dont't need to emit event to zeppelin server + * When zeppelinserver initiate angular object add. + * Dont't need to emit event to zeppelin server */ @Override public void angularObjectAdd(String name, String noteId, String paragraphId, String object) @@ -887,7 +894,9 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter // Generic java object type for json. Object value = null; try { - value = gson.fromJson(object, new TypeToken<Map<String, Object>>() {}.getType()); + value = gson.fromJson(object, + new TypeToken<Map<String, Object>>() { + }.getType()); } catch (Exception e) { // it's okay. proceed to treat object as a string logger.debug(e.getMessage(), e); @@ -902,8 +911,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public void angularObjectRemove(String name, String noteId, String paragraphId) - throws TException { + public void angularObjectRemove(String name, String noteId, String paragraphId) throws + TException { AngularObjectRegistry registry = interpreterGroup.getAngularObjectRegistry(); registry.remove(name, noteId, paragraphId, false); } @@ -962,13 +971,19 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } else { try { Object o = resource.get(); - Method method = o.getClass().getMethod(message.methodName, message.getParamTypes()); + Method method = o.getClass().getMethod( + message.methodName, + message.getParamTypes()); Object ret = method.invoke(o, message.params); if (message.shouldPutResultIntoResourcePool()) { // if return resource name is specified, // then put result into resource pool // and return empty byte buffer - resourcePool.put(noteId, paragraphId, message.returnResourceName, ret); + resourcePool.put( + noteId, + paragraphId, + message.returnResourceName, + ret); return ByteBuffer.allocate(0); } else { // if return resource name is not specified, @@ -1015,38 +1030,41 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter @Override public void angularRegistryPush(String registryAsString) throws TException { try { - Map<String, Map<String, AngularObject>> deserializedRegistry = - gson.fromJson( - registryAsString, - new TypeToken<Map<String, Map<String, AngularObject>>>() {}.getType()); + Map<String, Map<String, AngularObject>> deserializedRegistry = gson + .fromJson(registryAsString, + new TypeToken<Map<String, Map<String, AngularObject>>>() { + }.getType()); interpreterGroup.getAngularObjectRegistry().setRegistry(deserializedRegistry); } catch (Exception e) { logger.info("Exception in RemoteInterpreterServer while angularRegistryPush, nolock", e); } } - protected InterpreterOutput createAppOutput( - final String noteId, final String paragraphId, final String appId) { - return new InterpreterOutput( - new InterpreterOutputListener() { - @Override - public void onUpdateAll(InterpreterOutput out) {} + protected InterpreterOutput createAppOutput(final String noteId, + final String paragraphId, + final String appId) { + return new InterpreterOutput(new InterpreterOutputListener() { + @Override + public void onUpdateAll(InterpreterOutput out) { - @Override - public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { - intpEventClient.onAppOutputAppend(noteId, paragraphId, index, appId, new String(line)); - } + } + + @Override + public void onAppend(int index, InterpreterResultMessageOutput out, byte[] line) { + intpEventClient.onAppOutputAppend(noteId, paragraphId, index, appId, new String(line)); + } + + @Override + public void onUpdate(int index, InterpreterResultMessageOutput out) { + try { + intpEventClient.onAppOutputUpdate(noteId, paragraphId, index, appId, + out.getType(), new String(out.toByteArray())); + } catch (IOException e) { + logger.error(e.getMessage(), e); + } + } + }); - @Override - public void onUpdate(int index, InterpreterResultMessageOutput out) { - try { - intpEventClient.onAppOutputUpdate( - noteId, paragraphId, index, appId, out.getType(), new String(out.toByteArray())); - } catch (IOException e) { - logger.error(e.getMessage(), e); - } - } - }); } private ApplicationContext getApplicationContext( @@ -1069,8 +1087,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter return new RemoteApplicationResult(true, ""); } HeliumPackage pkgInfo = HeliumPackage.fromJson(packageInfo); - ApplicationContext context = - getApplicationContext(pkgInfo, noteId, paragraphId, applicationInstanceId); + ApplicationContext context = getApplicationContext( + pkgInfo, noteId, paragraphId, applicationInstanceId); try { Application app = null; logger.info( @@ -1083,7 +1101,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter paragraphId); app = appLoader.load(pkgInfo, context); runningApplications.put( - applicationInstanceId, new RunningApplication(pkgInfo, app, noteId, paragraphId)); + applicationInstanceId, + new RunningApplication(pkgInfo, app, noteId, paragraphId)); return new RemoteApplicationResult(true, ""); } catch (Exception e) { logger.error(e.getMessage(), e); @@ -1092,7 +1111,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public RemoteApplicationResult unloadApplication(String applicationInstanceId) throws TException { + public RemoteApplicationResult unloadApplication(String applicationInstanceId) + throws TException { RunningApplication runningApplication = runningApplications.remove(applicationInstanceId); if (runningApplication != null) { try { @@ -1107,7 +1127,8 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter } @Override - public RemoteApplicationResult runApplication(String applicationInstanceId) throws TException { + public RemoteApplicationResult runApplication(String applicationInstanceId) + throws TException { logger.info("run application {}", applicationInstanceId); RunningApplication runningApp = runningApplications.get(applicationInstanceId); @@ -1119,9 +1140,10 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter try { context.out.clear(); context.out.setType(InterpreterResult.Type.ANGULAR); - ResourceSet resource = - appLoader.findRequiredResourceSet( - runningApp.pkg.getResources(), context.getNoteId(), context.getParagraphId()); + ResourceSet resource = appLoader.findRequiredResourceSet( + runningApp.pkg.getResources(), + context.getNoteId(), + context.getParagraphId()); for (Resource res : resource) { System.err.println("Resource " + res.get()); } @@ -1148,11 +1170,16 @@ public class RemoteInterpreterServer extends Thread implements RemoteInterpreter public final String noteId; public final String paragraphId; - RunningApplication(HeliumPackage pkg, Application app, String noteId, String paragraphId) { + RunningApplication(HeliumPackage pkg, + Application app, + String noteId, + String paragraphId) { this.app = app; this.pkg = pkg; this.noteId = noteId; this.paragraphId = paragraphId; } - }; + } + + ; }
http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java index 94f9447..cf82247 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/remote/RemoteInterpreterUtils.java @@ -17,6 +17,12 @@ package org.apache.zeppelin.interpreter.remote; +import org.apache.commons.lang.StringUtils; +import org.apache.thrift.transport.TServerSocket; +import org.apache.thrift.transport.TTransportException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.IOException; import java.net.ConnectException; import java.net.Inet4Address; @@ -29,19 +35,17 @@ import java.net.Socket; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Collections; -import org.apache.commons.lang.StringUtils; -import org.apache.thrift.transport.TServerSocket; -import org.apache.thrift.transport.TTransportException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/** */ +/** + * + */ public class RemoteInterpreterUtils { static Logger LOGGER = LoggerFactory.getLogger(RemoteInterpreterUtils.class); + public static int findRandomAvailablePortOnAllLocalInterfaces() throws IOException { int port; - try (ServerSocket socket = new ServerSocket(0); ) { + try (ServerSocket socket = new ServerSocket(0);) { port = socket.getLocalPort(); socket.close(); } @@ -55,7 +59,8 @@ public class RemoteInterpreterUtils { * @return * @throws IOException */ - public static TServerSocket createTServerSocket(String portRange) throws IOException { + public static TServerSocket createTServerSocket(String portRange) + throws IOException { TServerSocket tSocket = null; // ':' is the default value which means no constraints on the portRange @@ -91,8 +96,8 @@ public class RemoteInterpreterUtils { public static String findAvailableHostAddress() throws UnknownHostException, SocketException { InetAddress address = InetAddress.getLocalHost(); if (address.isLoopbackAddress()) { - for (NetworkInterface networkInterface : - Collections.list(NetworkInterface.getNetworkInterfaces())) { + for (NetworkInterface networkInterface : Collections + .list(NetworkInterface.getNetworkInterfaces())) { if (!networkInterface.isLoopback()) { for (InterfaceAddress interfaceAddress : networkInterface.getInterfaceAddresses()) { InetAddress a = interfaceAddress.getAddress(); @@ -116,27 +121,15 @@ public class RemoteInterpreterUtils { } catch (ConnectException cne) { // end point is not accessible if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Remote endpoint '" - + host - + ":" - + port - + "' is not accessible " - + "(might be initializing): " - + cne.getMessage()); + LOGGER.debug("Remote endpoint '" + host + ":" + port + "' is not accessible " + + "(might be initializing): " + cne.getMessage()); } return false; } catch (IOException ioe) { // end point is not accessible if (LOGGER.isDebugEnabled()) { - LOGGER.debug( - "Remote endpoint '" - + host - + ":" - + port - + "' is not accessible " - + "(might be initializing): " - + ioe.getMessage()); + LOGGER.debug("Remote endpoint '" + host + ":" + port + "' is not accessible " + + "(might be initializing): " + ioe.getMessage()); } return false; } @@ -158,4 +151,5 @@ public class RemoteInterpreterUtils { return key.matches("^[A-Z_0-9]*"); } + } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AngularObjectId.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AngularObjectId.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AngularObjectId.java index 0c295ef..b659d94 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AngularObjectId.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AngularObjectId.java @@ -1,65 +1,65 @@ /** - * 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 * - * <p>http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * <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 + * 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. */ /** * Autogenerated by Thrift Compiler (0.9.2) * - * <p>DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package org.apache.zeppelin.interpreter.thrift; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Collections; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; + import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-8-9") -public class AngularObjectId - implements org.apache.thrift.TBase<AngularObjectId, AngularObjectId._Fields>, - java.io.Serializable, - Cloneable, - Comparable<AngularObjectId> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = - new org.apache.thrift.protocol.TStruct("AngularObjectId"); - - private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "noteId", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "paragraphId", org.apache.thrift.protocol.TType.STRING, (short) 2); - private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "name", org.apache.thrift.protocol.TType.STRING, (short) 3); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = - new HashMap<Class<? extends IScheme>, SchemeFactory>(); +public class AngularObjectId implements org.apache.thrift.TBase<AngularObjectId, AngularObjectId._Fields>, java.io.Serializable, Cloneable, Comparable<AngularObjectId> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AngularObjectId"); + + private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new AngularObjectIdStandardSchemeFactory()); schemes.put(TupleScheme.class, new AngularObjectIdTupleSchemeFactory()); @@ -69,14 +69,11 @@ public class AngularObjectId public String paragraphId; // required public String name; // required - /** - * The set of fields this struct contains, along with convenience methods for finding and - * manipulating them. - */ + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - NOTE_ID((short) 1, "noteId"), - PARAGRAPH_ID((short) 2, "paragraphId"), - NAME((short) 3, "name"); + NOTE_ID((short)1, "noteId"), + PARAGRAPH_ID((short)2, "paragraphId"), + NAME((short)3, "name"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -86,9 +83,11 @@ public class AngularObjectId } } - /** Find the _Fields constant that matches fieldId, or null if its not found. */ + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { + switch(fieldId) { case 1: // NOTE_ID return NOTE_ID; case 2: // PARAGRAPH_ID @@ -100,15 +99,19 @@ public class AngularObjectId } } - /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } - /** Find the _Fields constant that matches name, or null if its not found. */ + /** + * Find the _Fields constant that matches name, or null if its not found. + */ public static _Fields findByName(String name) { return byName.get(name); } @@ -132,46 +135,35 @@ public class AngularObjectId // isset id assignments public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = - new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put( - _Fields.NOTE_ID, - new org.apache.thrift.meta_data.FieldMetaData( - "noteId", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); - tmpMap.put( - _Fields.PARAGRAPH_ID, - new org.apache.thrift.meta_data.FieldMetaData( - "paragraphId", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); - tmpMap.put( - _Fields.NAME, - new org.apache.thrift.meta_data.FieldMetaData( - "name", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( - AngularObjectId.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AngularObjectId.class, metaDataMap); } - public AngularObjectId() {} + public AngularObjectId() { + } - public AngularObjectId(String noteId, String paragraphId, String name) { + public AngularObjectId( + String noteId, + String paragraphId, + String name) + { this(); this.noteId = noteId; this.paragraphId = paragraphId; this.name = name; } - /** Performs a deep copy on <i>other</i>. */ + /** + * Performs a deep copy on <i>other</i>. + */ public AngularObjectId(AngularObjectId other) { if (other.isSetNoteId()) { this.noteId = other.noteId; @@ -269,95 +261,103 @@ public class AngularObjectId public void setFieldValue(_Fields field, Object value) { switch (field) { - case NOTE_ID: - if (value == null) { - unsetNoteId(); - } else { - setNoteId((String) value); - } - break; + case NOTE_ID: + if (value == null) { + unsetNoteId(); + } else { + setNoteId((String)value); + } + break; - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((String) value); - } - break; + case PARAGRAPH_ID: + if (value == null) { + unsetParagraphId(); + } else { + setParagraphId((String)value); + } + break; + + case NAME: + if (value == null) { + unsetName(); + } else { + setName((String)value); + } + break; - case NAME: - if (value == null) { - unsetName(); - } else { - setName((String) value); - } - break; } } public Object getFieldValue(_Fields field) { switch (field) { - case NOTE_ID: - return getNoteId(); + case NOTE_ID: + return getNoteId(); + + case PARAGRAPH_ID: + return getParagraphId(); - case PARAGRAPH_ID: - return getParagraphId(); + case NAME: + return getName(); - case NAME: - return getName(); } throw new IllegalStateException(); } - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false - * otherwise - */ + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { - case NOTE_ID: - return isSetNoteId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - case NAME: - return isSetName(); + case NOTE_ID: + return isSetNoteId(); + case PARAGRAPH_ID: + return isSetParagraphId(); + case NAME: + return isSetName(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { - if (that == null) return false; - if (that instanceof AngularObjectId) return this.equals((AngularObjectId) that); + if (that == null) + return false; + if (that instanceof AngularObjectId) + return this.equals((AngularObjectId)that); return false; } public boolean equals(AngularObjectId that) { - if (that == null) return false; + if (that == null) + return false; boolean this_present_noteId = true && this.isSetNoteId(); boolean that_present_noteId = true && that.isSetNoteId(); if (this_present_noteId || that_present_noteId) { - if (!(this_present_noteId && that_present_noteId)) return false; - if (!this.noteId.equals(that.noteId)) return false; + if (!(this_present_noteId && that_present_noteId)) + return false; + if (!this.noteId.equals(that.noteId)) + return false; } boolean this_present_paragraphId = true && this.isSetParagraphId(); boolean that_present_paragraphId = true && that.isSetParagraphId(); if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) return false; - if (!this.paragraphId.equals(that.paragraphId)) return false; + if (!(this_present_paragraphId && that_present_paragraphId)) + return false; + if (!this.paragraphId.equals(that.paragraphId)) + return false; } boolean this_present_name = true && this.isSetName(); boolean that_present_name = true && that.isSetName(); if (this_present_name || that_present_name) { - if (!(this_present_name && that_present_name)) return false; - if (!this.name.equals(that.name)) return false; + if (!(this_present_name && that_present_name)) + return false; + if (!this.name.equals(that.name)) + return false; } return true; @@ -369,15 +369,18 @@ public class AngularObjectId boolean present_noteId = true && (isSetNoteId()); list.add(present_noteId); - if (present_noteId) list.add(noteId); + if (present_noteId) + list.add(noteId); boolean present_paragraphId = true && (isSetParagraphId()); list.add(present_paragraphId); - if (present_paragraphId) list.add(paragraphId); + if (present_paragraphId) + list.add(paragraphId); boolean present_name = true && (isSetName()); list.add(present_name); - if (present_name) list.add(name); + if (present_name) + list.add(name); return list.hashCode(); } @@ -431,8 +434,7 @@ public class AngularObjectId schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } - public void write(org.apache.thrift.protocol.TProtocol oprot) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @@ -475,20 +477,15 @@ public class AngularObjectId private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { - write( - new org.apache.thrift.protocol.TCompactProtocol( - new org.apache.thrift.transport.TIOStreamTransport(out))); + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { - read( - new org.apache.thrift.protocol.TCompactProtocol( - new org.apache.thrift.transport.TIOStreamTransport(in))); + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } @@ -502,13 +499,13 @@ public class AngularObjectId private static class AngularObjectIdStandardScheme extends StandardScheme<AngularObjectId> { - public void read(org.apache.thrift.protocol.TProtocol iprot, AngularObjectId struct) - throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, AngularObjectId struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); - while (true) { + while (true) + { schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { @@ -516,7 +513,7 @@ public class AngularObjectId if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.noteId = iprot.readString(); struct.setNoteIdIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -524,7 +521,7 @@ public class AngularObjectId if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.paragraphId = iprot.readString(); struct.setParagraphIdIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -532,7 +529,7 @@ public class AngularObjectId if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.name = iprot.readString(); struct.setNameIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -547,8 +544,7 @@ public class AngularObjectId struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, AngularObjectId struct) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, AngularObjectId struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -570,6 +566,7 @@ public class AngularObjectId oprot.writeFieldStop(); oprot.writeStructEnd(); } + } private static class AngularObjectIdTupleSchemeFactory implements SchemeFactory { @@ -581,8 +578,7 @@ public class AngularObjectId private static class AngularObjectIdTupleScheme extends TupleScheme<AngularObjectId> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AngularObjectId struct) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, AngularObjectId struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetNoteId()) { @@ -607,8 +603,7 @@ public class AngularObjectId } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AngularObjectId struct) - throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, AngularObjectId struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(3); if (incoming.get(0)) { @@ -625,4 +620,6 @@ public class AngularObjectId } } } + } + http://git-wip-us.apache.org/repos/asf/zeppelin/blob/0d746fa2/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java ---------------------------------------------------------------------- diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java index f806b29..c0ec91f 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/thrift/AppOutputAppendEvent.java @@ -1,72 +1,67 @@ /** - * 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 * - * <p>http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * <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 + * 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. */ /** * Autogenerated by Thrift Compiler (0.9.2) * - * <p>DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * - * @generated + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ package org.apache.zeppelin.interpreter.thrift; -import java.util.ArrayList; -import java.util.BitSet; -import java.util.Collections; -import java.util.EnumMap; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.annotation.Generated; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; + import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) @Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2018-8-9") -public class AppOutputAppendEvent - implements org.apache.thrift.TBase<AppOutputAppendEvent, AppOutputAppendEvent._Fields>, - java.io.Serializable, - Cloneable, - Comparable<AppOutputAppendEvent> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = - new org.apache.thrift.protocol.TStruct("AppOutputAppendEvent"); - - private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "noteId", org.apache.thrift.protocol.TType.STRING, (short) 1); - private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "paragraphId", org.apache.thrift.protocol.TType.STRING, (short) 2); - private static final org.apache.thrift.protocol.TField APP_ID_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "appId", org.apache.thrift.protocol.TType.STRING, (short) 3); - private static final org.apache.thrift.protocol.TField INDEX_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "index", org.apache.thrift.protocol.TType.I32, (short) 4); - private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = - new org.apache.thrift.protocol.TField( - "data", org.apache.thrift.protocol.TType.STRING, (short) 5); - - private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = - new HashMap<Class<? extends IScheme>, SchemeFactory>(); +public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAppendEvent, AppOutputAppendEvent._Fields>, java.io.Serializable, Cloneable, Comparable<AppOutputAppendEvent> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("AppOutputAppendEvent"); + private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField PARAGRAPH_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("paragraphId", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField APP_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("appId", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField INDEX_FIELD_DESC = new org.apache.thrift.protocol.TField("index", org.apache.thrift.protocol.TType.I32, (short)4); + private static final org.apache.thrift.protocol.TField DATA_FIELD_DESC = new org.apache.thrift.protocol.TField("data", org.apache.thrift.protocol.TType.STRING, (short)5); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new AppOutputAppendEventStandardSchemeFactory()); schemes.put(TupleScheme.class, new AppOutputAppendEventTupleSchemeFactory()); @@ -78,16 +73,13 @@ public class AppOutputAppendEvent public int index; // required public String data; // required - /** - * The set of fields this struct contains, along with convenience methods for finding and - * manipulating them. - */ + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - NOTE_ID((short) 1, "noteId"), - PARAGRAPH_ID((short) 2, "paragraphId"), - APP_ID((short) 3, "appId"), - INDEX((short) 4, "index"), - DATA((short) 5, "data"); + NOTE_ID((short)1, "noteId"), + PARAGRAPH_ID((short)2, "paragraphId"), + APP_ID((short)3, "appId"), + INDEX((short)4, "index"), + DATA((short)5, "data"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -97,9 +89,11 @@ public class AppOutputAppendEvent } } - /** Find the _Fields constant that matches fieldId, or null if its not found. */ + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ public static _Fields findByThriftId(int fieldId) { - switch (fieldId) { + switch(fieldId) { case 1: // NOTE_ID return NOTE_ID; case 2: // PARAGRAPH_ID @@ -115,15 +109,19 @@ public class AppOutputAppendEvent } } - /** Find the _Fields constant that matches fieldId, throwing an exception if it is not found. */ + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); - if (fields == null) - throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } - /** Find the _Fields constant that matches name, or null if its not found. */ + /** + * Find the _Fields constant that matches name, or null if its not found. + */ public static _Fields findByName(String name) { return byName.get(name); } @@ -149,54 +147,32 @@ public class AppOutputAppendEvent private static final int __INDEX_ISSET_ID = 0; private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; - static { - Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = - new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put( - _Fields.NOTE_ID, - new org.apache.thrift.meta_data.FieldMetaData( - "noteId", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); - tmpMap.put( - _Fields.PARAGRAPH_ID, - new org.apache.thrift.meta_data.FieldMetaData( - "paragraphId", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); - tmpMap.put( - _Fields.APP_ID, - new org.apache.thrift.meta_data.FieldMetaData( - "appId", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); - tmpMap.put( - _Fields.INDEX, - new org.apache.thrift.meta_data.FieldMetaData( - "index", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.I32))); - tmpMap.put( - _Fields.DATA, - new org.apache.thrift.meta_data.FieldMetaData( - "data", - org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData( - org.apache.thrift.protocol.TType.STRING))); + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.NOTE_ID, new org.apache.thrift.meta_data.FieldMetaData("noteId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.PARAGRAPH_ID, new org.apache.thrift.meta_data.FieldMetaData("paragraphId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.APP_ID, new org.apache.thrift.meta_data.FieldMetaData("appId", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.INDEX, new org.apache.thrift.meta_data.FieldMetaData("index", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32))); + tmpMap.put(_Fields.DATA, new org.apache.thrift.meta_data.FieldMetaData("data", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap( - AppOutputAppendEvent.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AppOutputAppendEvent.class, metaDataMap); } - public AppOutputAppendEvent() {} + public AppOutputAppendEvent() { + } public AppOutputAppendEvent( - String noteId, String paragraphId, String appId, int index, String data) { + String noteId, + String paragraphId, + String appId, + int index, + String data) + { this(); this.noteId = noteId; this.paragraphId = paragraphId; @@ -206,7 +182,9 @@ public class AppOutputAppendEvent this.data = data; } - /** Performs a deep copy on <i>other</i>. */ + /** + * Performs a deep copy on <i>other</i>. + */ public AppOutputAppendEvent(AppOutputAppendEvent other) { __isset_bitfield = other.__isset_bitfield; if (other.isSetNoteId()) { @@ -359,135 +337,147 @@ public class AppOutputAppendEvent public void setFieldValue(_Fields field, Object value) { switch (field) { - case NOTE_ID: - if (value == null) { - unsetNoteId(); - } else { - setNoteId((String) value); - } - break; + case NOTE_ID: + if (value == null) { + unsetNoteId(); + } else { + setNoteId((String)value); + } + break; - case PARAGRAPH_ID: - if (value == null) { - unsetParagraphId(); - } else { - setParagraphId((String) value); - } - break; + case PARAGRAPH_ID: + if (value == null) { + unsetParagraphId(); + } else { + setParagraphId((String)value); + } + break; - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((String) value); - } - break; + case APP_ID: + if (value == null) { + unsetAppId(); + } else { + setAppId((String)value); + } + break; - case INDEX: - if (value == null) { - unsetIndex(); - } else { - setIndex((Integer) value); - } - break; + case INDEX: + if (value == null) { + unsetIndex(); + } else { + setIndex((Integer)value); + } + break; + + case DATA: + if (value == null) { + unsetData(); + } else { + setData((String)value); + } + break; - case DATA: - if (value == null) { - unsetData(); - } else { - setData((String) value); - } - break; } } public Object getFieldValue(_Fields field) { switch (field) { - case NOTE_ID: - return getNoteId(); + case NOTE_ID: + return getNoteId(); - case PARAGRAPH_ID: - return getParagraphId(); + case PARAGRAPH_ID: + return getParagraphId(); - case APP_ID: - return getAppId(); + case APP_ID: + return getAppId(); - case INDEX: - return Integer.valueOf(getIndex()); + case INDEX: + return Integer.valueOf(getIndex()); + + case DATA: + return getData(); - case DATA: - return getData(); } throw new IllegalStateException(); } - /** - * Returns true if field corresponding to fieldID is set (has been assigned a value) and false - * otherwise - */ + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { - case NOTE_ID: - return isSetNoteId(); - case PARAGRAPH_ID: - return isSetParagraphId(); - case APP_ID: - return isSetAppId(); - case INDEX: - return isSetIndex(); - case DATA: - return isSetData(); + case NOTE_ID: + return isSetNoteId(); + case PARAGRAPH_ID: + return isSetParagraphId(); + case APP_ID: + return isSetAppId(); + case INDEX: + return isSetIndex(); + case DATA: + return isSetData(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { - if (that == null) return false; - if (that instanceof AppOutputAppendEvent) return this.equals((AppOutputAppendEvent) that); + if (that == null) + return false; + if (that instanceof AppOutputAppendEvent) + return this.equals((AppOutputAppendEvent)that); return false; } public boolean equals(AppOutputAppendEvent that) { - if (that == null) return false; + if (that == null) + return false; boolean this_present_noteId = true && this.isSetNoteId(); boolean that_present_noteId = true && that.isSetNoteId(); if (this_present_noteId || that_present_noteId) { - if (!(this_present_noteId && that_present_noteId)) return false; - if (!this.noteId.equals(that.noteId)) return false; + if (!(this_present_noteId && that_present_noteId)) + return false; + if (!this.noteId.equals(that.noteId)) + return false; } boolean this_present_paragraphId = true && this.isSetParagraphId(); boolean that_present_paragraphId = true && that.isSetParagraphId(); if (this_present_paragraphId || that_present_paragraphId) { - if (!(this_present_paragraphId && that_present_paragraphId)) return false; - if (!this.paragraphId.equals(that.paragraphId)) return false; + if (!(this_present_paragraphId && that_present_paragraphId)) + return false; + if (!this.paragraphId.equals(that.paragraphId)) + return false; } boolean this_present_appId = true && this.isSetAppId(); boolean that_present_appId = true && that.isSetAppId(); if (this_present_appId || that_present_appId) { - if (!(this_present_appId && that_present_appId)) return false; - if (!this.appId.equals(that.appId)) return false; + if (!(this_present_appId && that_present_appId)) + return false; + if (!this.appId.equals(that.appId)) + return false; } boolean this_present_index = true; boolean that_present_index = true; if (this_present_index || that_present_index) { - if (!(this_present_index && that_present_index)) return false; - if (this.index != that.index) return false; + if (!(this_present_index && that_present_index)) + return false; + if (this.index != that.index) + return false; } boolean this_present_data = true && this.isSetData(); boolean that_present_data = true && that.isSetData(); if (this_present_data || that_present_data) { - if (!(this_present_data && that_present_data)) return false; - if (!this.data.equals(that.data)) return false; + if (!(this_present_data && that_present_data)) + return false; + if (!this.data.equals(that.data)) + return false; } return true; @@ -499,23 +489,28 @@ public class AppOutputAppendEvent boolean present_noteId = true && (isSetNoteId()); list.add(present_noteId); - if (present_noteId) list.add(noteId); + if (present_noteId) + list.add(noteId); boolean present_paragraphId = true && (isSetParagraphId()); list.add(present_paragraphId); - if (present_paragraphId) list.add(paragraphId); + if (present_paragraphId) + list.add(paragraphId); boolean present_appId = true && (isSetAppId()); list.add(present_appId); - if (present_appId) list.add(appId); + if (present_appId) + list.add(appId); boolean present_index = true; list.add(present_index); - if (present_index) list.add(index); + if (present_index) + list.add(index); boolean present_data = true && (isSetData()); list.add(present_data); - if (present_data) list.add(data); + if (present_data) + list.add(data); return list.hashCode(); } @@ -589,8 +584,7 @@ public class AppOutputAppendEvent schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } - public void write(org.apache.thrift.protocol.TProtocol oprot) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @@ -645,23 +639,17 @@ public class AppOutputAppendEvent private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { - write( - new org.apache.thrift.protocol.TCompactProtocol( - new org.apache.thrift.transport.TIOStreamTransport(out))); + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } - private void readObject(java.io.ObjectInputStream in) - throws java.io.IOException, ClassNotFoundException { + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and - // doesn't call the default constructor. + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. __isset_bitfield = 0; - read( - new org.apache.thrift.protocol.TCompactProtocol( - new org.apache.thrift.transport.TIOStreamTransport(in))); + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } @@ -673,16 +661,15 @@ public class AppOutputAppendEvent } } - private static class AppOutputAppendEventStandardScheme - extends StandardScheme<AppOutputAppendEvent> { + private static class AppOutputAppendEventStandardScheme extends StandardScheme<AppOutputAppendEvent> { - public void read(org.apache.thrift.protocol.TProtocol iprot, AppOutputAppendEvent struct) - throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); - while (true) { + while (true) + { schemeField = iprot.readFieldBegin(); - if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { @@ -690,7 +677,7 @@ public class AppOutputAppendEvent if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.noteId = iprot.readString(); struct.setNoteIdIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -698,7 +685,7 @@ public class AppOutputAppendEvent if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.paragraphId = iprot.readString(); struct.setParagraphIdIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -706,7 +693,7 @@ public class AppOutputAppendEvent if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.appId = iprot.readString(); struct.setAppIdIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -714,7 +701,7 @@ public class AppOutputAppendEvent if (schemeField.type == org.apache.thrift.protocol.TType.I32) { struct.index = iprot.readI32(); struct.setIndexIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -722,7 +709,7 @@ public class AppOutputAppendEvent if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.data = iprot.readString(); struct.setDataIsSet(true); - } else { + } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; @@ -737,8 +724,7 @@ public class AppOutputAppendEvent struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, AppOutputAppendEvent struct) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -768,6 +754,7 @@ public class AppOutputAppendEvent oprot.writeFieldStop(); oprot.writeStructEnd(); } + } private static class AppOutputAppendEventTupleSchemeFactory implements SchemeFactory { @@ -779,8 +766,7 @@ public class AppOutputAppendEvent private static class AppOutputAppendEventTupleScheme extends TupleScheme<AppOutputAppendEvent> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) - throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetNoteId()) { @@ -817,8 +803,7 @@ public class AppOutputAppendEvent } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) - throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, AppOutputAppendEvent struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(5); if (incoming.get(0)) { @@ -843,4 +828,6 @@ public class AppOutputAppendEvent } } } + } +
