Browse Source

[livy] Bump scalatra version to 2.3.0, jetty to 9.2.10.v20150310

Erick Tryzelaar 10 years ago
parent
commit
239945da51

+ 3 - 4
apps/spark/java/livy-core/src/main/scala/com/cloudera/hue/livy/WebServer.scala

@@ -4,7 +4,7 @@ import java.net.{InetAddress, InetSocketAddress}
 import javax.servlet.ServletContextListener
 
 import ch.qos.logback.access.jetty.RequestLogImpl
-import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.server.{NetworkConnector, Server}
 import org.eclipse.jetty.server.handler.{HandlerCollection, RequestLogHandler}
 import org.eclipse.jetty.servlet.{ServletContextHandler, DefaultServlet}
 import org.scalatra.servlet.AsyncSupport
@@ -15,7 +15,7 @@ class WebServer(var host: String, var port: Int) extends Logging {
   val address = new InetSocketAddress(host, port)
   val server = new Server(address)
 
-  server.setGracefulShutdown(1000)
+  server.setStopTimeout(1000)
   server.setStopAtShutdown(true)
 
   val context = new ServletContextHandler()
@@ -45,9 +45,8 @@ class WebServer(var host: String, var port: Int) extends Logging {
   def start() = {
     server.start()
 
-    val connector = server.getConnectors()(0)
+    val connector = server.getConnectors()(0).asInstanceOf[NetworkConnector]
 
-    host = connector.getHost
     if (host == "0.0.0.0") {
       host = InetAddress.getLocalHost.getHostAddress
     }

+ 3 - 2
apps/spark/java/livy-repl/src/main/scala/com/cloudera/hue/livy/repl/Main.scala

@@ -1,5 +1,6 @@
 package com.cloudera.hue.livy.repl
 
+import java.util.concurrent.TimeUnit
 import javax.servlet.ServletContext
 
 import com.cloudera.hue.livy.repl.python.PythonSession
@@ -118,7 +119,7 @@ class ScalatraBootstrap extends LifeCycle with Logging {
         case _ => System.exit(1)
       }
 
-      Await.result(rep, 10 seconds)
+      Await.result(rep, Duration(10, TimeUnit.SECONDS))
     }
   }
 
@@ -133,4 +134,4 @@ class ScalatraBootstrap extends LifeCycle with Logging {
       replUrl
     }
   }
-}
+}

+ 2 - 3
apps/spark/java/livy-repl/src/test/scala/com/cloudera/hue/livy/repl/PythonSessionSpec.scala

@@ -3,13 +3,12 @@ package com.cloudera.hue.livy.repl
 import com.cloudera.hue.livy.repl.python.PythonSession
 import org.json4s.JsonAST.JValue
 import org.json4s.{Extraction, DefaultFormats}
-import org.scalatest.{BeforeAndAfter, FunSpec}
-import org.scalatest.matchers.ShouldMatchers
+import org.scalatest.{Matchers, BeforeAndAfter, FunSpec}
 
 import _root_.scala.concurrent.Await
 import _root_.scala.concurrent.duration.Duration
 
-class PythonSessionSpec extends FunSpec with ShouldMatchers with BeforeAndAfter {
+class PythonSessionSpec extends FunSpec with Matchers with BeforeAndAfter {
 
   implicit val formats = DefaultFormats
 

+ 2 - 3
apps/spark/java/livy-repl/src/test/scala/com/cloudera/hue/livy/repl/SparkSessionSpec.scala

@@ -3,13 +3,12 @@ package com.cloudera.hue.livy.repl
 import com.cloudera.hue.livy.repl.scala.SparkSession
 import org.json4s.JsonAST.JValue
 import org.json4s.{DefaultFormats, Extraction}
-import org.scalatest.matchers.ShouldMatchers
-import org.scalatest.{BeforeAndAfter, FunSpec}
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
 
 import _root_.scala.concurrent.Await
 import _root_.scala.concurrent.duration.Duration
 
-class SparkSessionSpec extends FunSpec with ShouldMatchers with BeforeAndAfter {
+class SparkSessionSpec extends FunSpec with Matchers with BeforeAndAfter {
 
   implicit val formats = DefaultFormats
 

+ 2 - 2
apps/spark/java/livy-repl/src/test/scala/com/cloudera/hue/livy/repl/WebAppSpec.scala

@@ -5,11 +5,11 @@ import org.json4s.JsonAST.{JArray, JString}
 import org.json4s.JsonDSL._
 import org.json4s.jackson.JsonMethods._
 import org.json4s.{DefaultFormats, Extraction, JValue}
-import org.scalatest.{BeforeAndAfter, FunSpec}
+import org.scalatest.{FunSpecLike, BeforeAndAfter}
 import org.scalatra.test.scalatest.ScalatraSuite
 import _root_.scala.concurrent.Future
 
-class WebAppSpec extends ScalatraSuite with FunSpec with BeforeAndAfter {
+class WebAppSpec extends ScalatraSuite with FunSpecLike with BeforeAndAfter {
 
   implicit val formats = DefaultFormats
 

+ 2 - 1
apps/spark/java/livy-server/src/main/scala/com/cloudera/hue/livy/server/WebApp.scala

@@ -1,6 +1,7 @@
 package com.cloudera.hue.livy.server
 
 import java.net.URL
+import java.util.concurrent.TimeUnit
 
 import com.cloudera.hue.livy.Logging
 import com.cloudera.hue.livy.msgs.ExecuteRequest
@@ -167,7 +168,7 @@ class WebApp(sessionManager: SessionManager)
   private def formatStatement(statement: Statement) = {
     // Take a couple milliseconds to see if the statement has finished.
     val output = try {
-      Await.result(statement.output, 100 milliseconds)
+      Await.result(statement.output, Duration(100, TimeUnit.MILLISECONDS))
     } catch {
       case _: TimeoutException => null
     }

+ 3 - 1
apps/spark/java/livy-server/src/main/scala/com/cloudera/hue/livy/server/sessions/YarnSession.scala

@@ -1,5 +1,7 @@
 package com.cloudera.hue.livy.server.sessions
 
+import java.util.concurrent.TimeUnit
+
 import com.cloudera.hue.livy.yarn.{Client, Job}
 
 import scala.concurrent.{Await, ExecutionContext, ExecutionContextExecutor, Future}
@@ -25,7 +27,7 @@ private class YarnSession(id: String, job: Future[Job]) extends WebSession(id) {
     super.stop().andThen {
       case _ =>
         try {
-          val job_ = Await.result(job, 1 second)
+          val job_ = Await.result(job, Duration(1, TimeUnit.SECONDS))
           job_.waitForFinish(10000)
         } catch {
           case e: Throwable =>

+ 3 - 4
apps/spark/java/livy-server/src/test/scala/com/cloudera/hue/livy/server/ThreadSessionSpec.scala

@@ -2,14 +2,13 @@ package com.cloudera.hue.livy.server
 
 import com.cloudera.hue.livy.msgs.ExecuteRequest
 import com.cloudera.hue.livy.server.sessions.{Session, ThreadSession}
-import org.json4s.{Extraction, DefaultFormats}
-import org.scalatest.matchers.ShouldMatchers
-import org.scalatest.{BeforeAndAfter, FunSpec}
+import org.json4s.{DefaultFormats, Extraction}
+import org.scalatest.{BeforeAndAfter, FunSpec, Matchers}
 
 import scala.concurrent.Await
 import scala.concurrent.duration.Duration
 
-class ThreadSessionSpec extends FunSpec with ShouldMatchers with BeforeAndAfter {
+class ThreadSessionSpec extends FunSpec with Matchers with BeforeAndAfter {
 
   implicit val formats = DefaultFormats
 

+ 7 - 3
apps/spark/java/pom.xml

@@ -48,12 +48,12 @@
 
     <properties>
         <guava.version>11.0.2</guava.version>
-        <jetty.version>8.1.14.v20131031</jetty.version>
+        <jetty.version>9.2.10.v20150310</jetty.version>
         <json4s.version>3.2.11</json4s.version>
         <logback.version>1.1.2</logback.version>
-        <scala.version>2.10.3</scala.version>
+        <scala.version>2.10.4</scala.version>
         <scala.binary.version>2.10</scala.binary.version>
-        <scalatra.version>2.2.1</scalatra.version>
+        <scalatra.version>2.3.0</scalatra.version>
         <dispatch.version>0.11.2</dispatch.version>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
@@ -301,6 +301,10 @@
                     </executions>
                     <configuration>
                         <scalaVersion>${scala.version}</scalaVersion>
+                        <args>
+                            <arg>-deprecation</arg>
+                            <arg>-feature</arg>
+                        </args>
                     </configuration>
                 </plugin>