http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/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 11e6bdb..1188651 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,6 +19,22 @@ 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; @@ -73,29 +89,8 @@ import org.apache.zeppelin.user.AuthenticationInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -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 { +/** 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); @@ -128,19 +123,21 @@ public class RemoteInterpreterServer extends Thread 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; @@ -169,8 +166,8 @@ public class RemoteInterpreterServer extends Thread 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>()); } @@ -178,34 +175,36 @@ public class RemoteInterpreterServer extends Thread @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(); } @@ -232,8 +231,8 @@ public class RemoteInterpreterServer extends Thread // 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) { @@ -258,7 +257,6 @@ public class RemoteInterpreterServer extends Thread } } - public static void main(String[] args) throws TTransportException, InterruptedException, IOException { String zeppelinServerHost = null; @@ -281,8 +279,13 @@ public class RemoteInterpreterServer extends Thread } @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); @@ -295,8 +298,8 @@ public class RemoteInterpreterServer extends Thread 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); @@ -310,17 +313,21 @@ public class RemoteInterpreterServer extends Thread 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); } @@ -368,8 +375,8 @@ public class RemoteInterpreterServer extends Thread } } } - throw new TException(new InterpreterException("Interpreter instance " - + className + " not found")); + throw new TException( + new InterpreterException("Interpreter instance " + className + " not found")); } @Override @@ -424,10 +431,9 @@ public class RemoteInterpreterServer extends Thread } } - @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); @@ -438,13 +444,14 @@ public class RemoteInterpreterServer extends Thread 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()) { @@ -459,22 +466,18 @@ public class RemoteInterpreterServer extends Thread 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) { @@ -486,7 +489,6 @@ public class RemoteInterpreterServer extends Thread public static class InterpretJob extends Job<InterpreterResult> { - private Interpreter interpreter; private String script; private InterpreterContext context; @@ -525,39 +527,40 @@ public class RemoteInterpreterServer extends Thread } 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; - } - } + 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; - } + 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()); + @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; + } + } - // 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; } - } - - InterpretJob.this.script = script; - } - }; + }; hookListener.onPreExecute(script); hookListener.onPostExecute(script); } @@ -610,11 +613,13 @@ public class RemoteInterpreterServer extends Thread 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); @@ -635,11 +640,10 @@ public class RemoteInterpreterServer extends Thread } } - @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(); @@ -657,8 +661,8 @@ public class RemoteInterpreterServer extends Thread } @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) { @@ -666,8 +670,8 @@ public class RemoteInterpreterServer extends Thread } 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)); @@ -677,7 +681,6 @@ public class RemoteInterpreterServer extends Thread } } - @Override public String getFormType(String sessionId, String className) throws TException { Interpreter intp = getInterpreter(sessionId, className); @@ -689,11 +692,12 @@ public class RemoteInterpreterServer extends Thread } @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 { @@ -718,8 +722,8 @@ public class RemoteInterpreterServer extends Thread .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()) @@ -729,64 +733,56 @@ public class RemoteInterpreterServer extends Thread .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); + } + } - 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); - } + @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); - } - } - }); + @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(); } @@ -797,7 +793,7 @@ public class RemoteInterpreterServer extends Thread 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())) { @@ -822,7 +818,7 @@ public class RemoteInterpreterServer extends Thread * 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 @@ -845,7 +841,7 @@ public class RemoteInterpreterServer extends Thread 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); @@ -859,9 +855,7 @@ public class RemoteInterpreterServer extends Thread // 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); @@ -877,8 +871,7 @@ public class RemoteInterpreterServer extends Thread } /** - * 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) @@ -894,9 +887,7 @@ public class RemoteInterpreterServer extends Thread // 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); @@ -911,8 +902,8 @@ public class RemoteInterpreterServer extends Thread } @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); } @@ -971,19 +962,13 @@ public class RemoteInterpreterServer extends Thread } 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, @@ -1030,41 +1015,38 @@ public class RemoteInterpreterServer extends Thread @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 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 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); + } + } + }); } private ApplicationContext getApplicationContext( @@ -1087,8 +1069,8 @@ public class RemoteInterpreterServer extends Thread 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( @@ -1101,8 +1083,7 @@ public class RemoteInterpreterServer extends Thread 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); @@ -1111,8 +1092,7 @@ public class RemoteInterpreterServer extends Thread } @Override - public RemoteApplicationResult unloadApplication(String applicationInstanceId) - throws TException { + public RemoteApplicationResult unloadApplication(String applicationInstanceId) throws TException { RunningApplication runningApplication = runningApplications.remove(applicationInstanceId); if (runningApplication != null) { try { @@ -1127,8 +1107,7 @@ public class RemoteInterpreterServer extends Thread } @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); @@ -1140,10 +1119,9 @@ public class RemoteInterpreterServer extends Thread 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()); } @@ -1170,16 +1148,11 @@ public class RemoteInterpreterServer extends Thread 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/55f6c91c/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 cf82247..94f9447 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,12 +17,6 @@ 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; @@ -35,17 +29,19 @@ 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(); } @@ -59,8 +55,7 @@ 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 @@ -96,8 +91,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(); @@ -121,15 +116,27 @@ 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; } @@ -151,5 +158,4 @@ public class RemoteInterpreterUtils { return key.matches("^[A-Z_0-9]*"); } - } http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/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 b659d94..0c295ef 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 * - * 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. */ /** * Autogenerated by Thrift Compiler (0.9.2) * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated + * <p>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); +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>(); - 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,11 +69,14 @@ public class AngularObjectId implements org.apache.thrift.TBase<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>(); @@ -83,11 +86,9 @@ public class AngularObjectId implements org.apache.thrift.TBase<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 @@ -99,19 +100,15 @@ public class AngularObjectId implements org.apache.thrift.TBase<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); } @@ -135,35 +132,46 @@ public class AngularObjectId implements org.apache.thrift.TBase<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; @@ -261,103 +269,95 @@ public class AngularObjectId implements org.apache.thrift.TBase<AngularObjectId, public void setFieldValue(_Fields field, Object value) { switch (field) { - 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 NOTE_ID: + if (value == null) { + unsetNoteId(); + } else { + setNoteId((String) value); + } + break; - case NAME: - if (value == null) { - unsetName(); - } else { - setName((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; } } public Object getFieldValue(_Fields field) { switch (field) { - case NOTE_ID: - return getNoteId(); - - case PARAGRAPH_ID: - return getParagraphId(); + case NOTE_ID: + return getNoteId(); - case NAME: - return getName(); + case PARAGRAPH_ID: + return getParagraphId(); + 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,18 +369,15 @@ public class AngularObjectId implements org.apache.thrift.TBase<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(); } @@ -434,7 +431,8 @@ public class AngularObjectId implements org.apache.thrift.TBase<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); } @@ -477,15 +475,20 @@ public class AngularObjectId implements org.apache.thrift.TBase<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); } @@ -499,13 +502,13 @@ public class AngularObjectId implements org.apache.thrift.TBase<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) { @@ -513,7 +516,7 @@ public class AngularObjectId implements org.apache.thrift.TBase<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; @@ -521,7 +524,7 @@ public class AngularObjectId implements org.apache.thrift.TBase<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; @@ -529,7 +532,7 @@ public class AngularObjectId implements org.apache.thrift.TBase<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; @@ -544,7 +547,8 @@ public class AngularObjectId implements org.apache.thrift.TBase<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); @@ -566,7 +570,6 @@ public class AngularObjectId implements org.apache.thrift.TBase<AngularObjectId, oprot.writeFieldStop(); oprot.writeStructEnd(); } - } private static class AngularObjectIdTupleSchemeFactory implements SchemeFactory { @@ -578,7 +581,8 @@ public class AngularObjectId implements org.apache.thrift.TBase<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()) { @@ -603,7 +607,8 @@ public class AngularObjectId implements org.apache.thrift.TBase<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)) { @@ -620,6 +625,4 @@ public class AngularObjectId implements org.apache.thrift.TBase<AngularObjectId, } } } - } - http://git-wip-us.apache.org/repos/asf/zeppelin/blob/55f6c91c/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 c0ec91f..f806b29 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,67 +1,72 @@ /** - * 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. */ /** * Autogenerated by Thrift Compiler (0.9.2) * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated + * <p>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"); +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>(); - 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()); @@ -73,13 +78,16 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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>(); @@ -89,11 +97,9 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp } } - /** - * 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 @@ -109,19 +115,15 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp } } - /** - * 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); } @@ -147,32 +149,54 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -182,9 +206,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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()) { @@ -337,147 +359,135 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp public void setFieldValue(_Fields field, Object value) { switch (field) { - 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 NOTE_ID: + if (value == null) { + unsetNoteId(); + } else { + setNoteId((String) value); + } + break; - case APP_ID: - if (value == null) { - unsetAppId(); - } else { - setAppId((String)value); - } - break; + case PARAGRAPH_ID: + if (value == null) { + unsetParagraphId(); + } else { + setParagraphId((String) value); + } + break; - case INDEX: - if (value == null) { - unsetIndex(); - } else { - setIndex((Integer)value); - } - break; + case APP_ID: + if (value == null) { + unsetAppId(); + } else { + setAppId((String) value); + } + break; - case DATA: - if (value == null) { - unsetData(); - } else { - setData((String)value); - } - break; + case INDEX: + if (value == null) { + unsetIndex(); + } else { + setIndex((Integer) 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 DATA: - return getData(); + case INDEX: + return Integer.valueOf(getIndex()); + 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; @@ -489,28 +499,23 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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(); } @@ -584,7 +589,8 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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); } @@ -639,17 +645,23 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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); } @@ -661,15 +673,16 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp } } - 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) { @@ -677,7 +690,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -685,7 +698,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -693,7 +706,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -701,7 +714,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -709,7 +722,7 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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; @@ -724,7 +737,8 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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); @@ -754,7 +768,6 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp oprot.writeFieldStop(); oprot.writeStructEnd(); } - } private static class AppOutputAppendEventTupleSchemeFactory implements SchemeFactory { @@ -766,7 +779,8 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp 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()) { @@ -803,7 +817,8 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp } @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)) { @@ -828,6 +843,4 @@ public class AppOutputAppendEvent implements org.apache.thrift.TBase<AppOutputAp } } } - } -
