From 432a227320e505a1790d6fb22463ab3eba4fc830 Mon Sep 17 00:00:00 2001 From: prashant Date: Tue, 19 Mar 2013 12:29:08 +0530 Subject: fixed autocompletion apparent hang due to logging --- repl/lib/scala-jline.jar | Bin 158463 -> 0 bytes repl/src/main/scala/spark/repl/SparkILoopInit.scala | 8 ++++---- .../main/scala/spark/repl/SparkJLineCompletion.scala | 9 +++++---- 3 files changed, 9 insertions(+), 8 deletions(-) delete mode 100644 repl/lib/scala-jline.jar (limited to 'repl') diff --git a/repl/lib/scala-jline.jar b/repl/lib/scala-jline.jar deleted file mode 100644 index 2f18c95cdd..0000000000 Binary files a/repl/lib/scala-jline.jar and /dev/null differ diff --git a/repl/src/main/scala/spark/repl/SparkILoopInit.scala b/repl/src/main/scala/spark/repl/SparkILoopInit.scala index b52c477474..b275faf981 100644 --- a/repl/src/main/scala/spark/repl/SparkILoopInit.scala +++ b/repl/src/main/scala/spark/repl/SparkILoopInit.scala @@ -31,7 +31,9 @@ trait SparkILoopInit { val welcomeMsg = "Using Scala %s (%s, Java %s)".format( versionString, javaVmName, javaVersion) echo(welcomeMsg) - } + echo("Type in expressions to have them evaluated.") + echo("Type :help for more information.") + } protected def asyncMessage(msg: String) { if (isReplInfo || isReplPower) @@ -119,8 +121,6 @@ trait SparkILoopInit { """) command("import spark.SparkContext._"); } - // echo("Type in expressions to have them evaluated.") - // echo("Type :help for more information.") } // code to be executed only after the interpreter is initialized @@ -131,7 +131,7 @@ trait SparkILoopInit { } protected def runThunks(): Unit = synchronized { if (pendingThunks.nonEmpty) - println("Clearing " + pendingThunks.size + " thunks.") + logDebug("Clearing " + pendingThunks.size + " thunks.") while (pendingThunks.nonEmpty) { val thunk = pendingThunks.head diff --git a/repl/src/main/scala/spark/repl/SparkJLineCompletion.scala b/repl/src/main/scala/spark/repl/SparkJLineCompletion.scala index 98638d90f9..0e1170688d 100644 --- a/repl/src/main/scala/spark/repl/SparkJLineCompletion.scala +++ b/repl/src/main/scala/spark/repl/SparkJLineCompletion.scala @@ -14,10 +14,11 @@ import scala.tools.jline._ import scala.tools.jline.console.completer._ import Completion._ import scala.collection.mutable.ListBuffer +import spark.Logging // REPL completor - queries supplied interpreter for valid // completions based on current contents of buffer. -class SparkJLineCompletion(val intp: SparkIMain) extends Completion with CompletionOutput { +class SparkJLineCompletion(val intp: SparkIMain) extends Completion with CompletionOutput with Logging { val global: intp.global.type = intp.global import global._ import definitions.{ PredefModule, AnyClass, AnyRefClass, ScalaPackage, JavaLangPackage } @@ -318,7 +319,7 @@ class SparkJLineCompletion(val intp: SparkIMain) extends Completion with Complet // This is jline's entry point for completion. override def complete(buf: String, cursor: Int): Candidates = { verbosity = if (isConsecutiveTabs(buf, cursor)) verbosity + 1 else 0 - Console.println("\ncomplete(%s, %d) last = (%s, %d), verbosity: %s".format(buf, cursor, lastBuf, lastCursor, verbosity)) + logDebug("\ncomplete(%s, %d) last = (%s, %d), verbosity: %s".format(buf, cursor, lastBuf, lastCursor, verbosity)) // we don't try lower priority completions unless higher ones return no results. def tryCompletion(p: Parsed, completionFunction: Parsed => List[String]): Option[Candidates] = { @@ -331,7 +332,7 @@ class SparkJLineCompletion(val intp: SparkIMain) extends Completion with Complet val advance = commonPrefix(winners) lastCursor = p.position + advance.length lastBuf = (buf take p.position) + advance - Console.println("tryCompletion(%s, _) lastBuf = %s, lastCursor = %s, p.position = %s".format( + logDebug("tryCompletion(%s, _) lastBuf = %s, lastCursor = %s, p.position = %s".format( p, lastBuf, lastCursor, p.position)) p.position } @@ -365,7 +366,7 @@ class SparkJLineCompletion(val intp: SparkIMain) extends Completion with Complet */ try tryAll catch { case ex: Throwable => - Console.println("Error: complete(%s, %s) provoked".format(buf, cursor) + ex) + logWarning("Error: complete(%s, %s) provoked".format(buf, cursor) + ex) Candidates(cursor, if (isReplDebug) List("") else Nil -- cgit v1.2.3