zeppelin/java
Philipp Dallig fbea3e0858 [ZEPPELIN-5044] Refactoring some viewed classes
### What is this PR for?
During development, I came across code that did not conform to current best practices.
For example:
  - Logging
    - [Anti-Pattern-1](https://rolf-engelhard.de/2013/03/logging-anti-patterns-part-i/), [Anti-Pattern-2](https://rolf-engelhard.de/2013/04/logging-anti-patterns-part-ii/), [Anti-Pattern-3](https://rolf-engelhard.de/2013/10/logging-anti-patterns-part-iii/)
  - [try-with-resources](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)

### What type of PR is it?
Refactoring

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-5044

### How should this be tested?
* Travis CI: https://travis-ci.org/github/Reamer/zeppelin/builds/727295209

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: Philipp Dallig <philipp.dallig@gmail.com>

Closes #3909 from Reamer/refactoring and squashes the following commits:

dcf0417db [Philipp Dallig] Refactoring some viewed classes
2020-09-17 08:57:00 +02:00
..
src [ZEPPELIN-5044] Refactoring some viewed classes 2020-09-17 08:57:00 +02:00
pom.xml [ZEPPELIN-4244] Intellij shows URI not regietered error for xmlns urls 2019-07-19 14:31:44 +05:30
README.md [ZEPPELIN-3653] - New Java interpreter 2018-08-03 09:15:19 +08:00

Overview

Java interpreter for Apache Zeppelin

Architecture

Current interpreter implementation supports the static REPL. It compiles the code in memory, execute it and redirect the output to Zeppelin.

Technical overview

  • Upon starting an interpreter, an instance of JavaCompiler is created.

  • When the user runs commands with java, the JavaParser go through the code to get a class that contains the main method.

  • Then it replaces the class name with random class name to avoid overriding while compilation. It creates new out & err stream to get the data in new stream instead of the console, to redirect output to Zeppelin.

  • If there is any error during compilation, it can catch and redirect to Zeppelin.

  • JavaInterpreterUtils contains useful methods to print out Java collections and leverage Zeppelin's built in visualization.