1717
1818package org .apache .spark .repl
1919
20- import java .io .{ByteArrayOutputStream , InputStream }
20+ import java .io .{ByteArrayOutputStream , InputStream , FileNotFoundException }
2121import java .net .{URI , URL , URLEncoder }
2222import java .util .concurrent .{Executors , ExecutorService }
2323
2424import org .apache .hadoop .fs .{FileSystem , Path }
2525
26- import org .apache .spark .{SparkConf , SparkEnv }
26+ import org .apache .spark .{SparkConf , SparkEnv , Logging }
2727import org .apache .spark .deploy .SparkHadoopUtil
2828import org .apache .spark .util .Utils
2929import org .apache .spark .util .ParentClassLoader
@@ -37,7 +37,7 @@ import com.esotericsoftware.reflectasm.shaded.org.objectweb.asm.Opcodes._
3737 * Allows the user to specify if user class path should be first
3838 */
3939class ExecutorClassLoader (conf : SparkConf , classUri : String , parent : ClassLoader ,
40- userClassPathFirst : Boolean ) extends ClassLoader {
40+ userClassPathFirst : Boolean ) extends ClassLoader with Logging {
4141 val uri = new URI (classUri)
4242 val directory = uri.getPath
4343
@@ -91,7 +91,14 @@ class ExecutorClassLoader(conf: SparkConf, classUri: String, parent: ClassLoader
9191 inputStream.close()
9292 Some (defineClass(name, bytes, 0 , bytes.length))
9393 } catch {
94- case e : Exception => None
94+ case e : FileNotFoundException =>
95+ // We did not find the class
96+ logDebug(s " Did not load class $name from REPL class server at $uri" , e)
97+ None
98+ case e : Exception =>
99+ // Something bad happened while checking if the class exists
100+ logError(s " Failed to check existence of class $name on REPL class server at $uri" , e)
101+ None
95102 }
96103 }
97104
0 commit comments