mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-3880: Code refactoring: remove class files using a Java stream
This commit is contained in:
parent
6b9c29bdf6
commit
e174285e80
1 changed files with 11 additions and 15 deletions
|
|
@ -17,6 +17,13 @@
|
|||
|
||||
package org.apache.zeppelin.java;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.zeppelin.interpreter.Interpreter;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResult;
|
||||
|
|
@ -24,12 +31,6 @@ import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Java interpreter
|
||||
*/
|
||||
|
|
@ -48,15 +49,10 @@ public class JavaInterpreter extends Interpreter {
|
|||
|
||||
@Override
|
||||
public void close() {
|
||||
File dir = new File(".");
|
||||
File[] dirFiles = dir.listFiles();
|
||||
// delete all .class files created while compilation process
|
||||
for (int i = 0; i < dir.list().length; i++) {
|
||||
File f = dirFiles[i];
|
||||
if (f.getAbsolutePath().endsWith(".class")) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
/* Clean up .class files created during the compilation process. */
|
||||
Stream.of(
|
||||
new File(".").listFiles(f -> f.getAbsolutePath().endsWith(".class")))
|
||||
.forEach(f -> f.delete());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue