Browse Source

run mode fixed
no longer wrapping the json request in a DB transaction

Andreas C. Osowski 12 years ago
parent
commit
afba7f8e01

+ 3 - 1
lift-stateless/run

@@ -1 +1,3 @@
-java -XX:+CMSClassUnloadingEnabled -Xmx1024M -Xss2M -XX:MaxPermSize=512m -jar `dirname $0`/target/lift-stateless-assembly-0.0.1.jar
+cd `dirname $0`/target
+java -XX:+CMSClassUnloadingEnabled -Xmx1024M -Xss2M -XX:MaxPermSize=512m -jar lift-stateless-assembly-0.0.1.jar
+cd -

+ 2 - 2
lift-stateless/src/main/scala/Benchmark.scala

@@ -37,7 +37,7 @@ object DbBenchmark {
             case r @ Req("db" :: queries :: Nil, _ , _) => () => customQuery(queries.toInt)
     }
 
-  def customQuery(count: Int) : Box[LiftResponse] = {
+  def customQuery(count: Int) : Box[LiftResponse] = DB.exec {
     val tlc = ThreadLocalRandom.current()
     val randoms = for(i <- (1 to count)) yield tlc.nextLong(DB_ROWS)
     val result = (for {
@@ -48,7 +48,7 @@ object DbBenchmark {
     Full(JsonResponse(JArray(result.map(_.toJson))))
   }
 
-  def singleQuery() : Box[LiftResponse] = {
+  def singleQuery() : Box[LiftResponse] = DB.exec {
     val tlc = ThreadLocalRandom.current()
     val random = tlc.nextLong(DB_ROWS)
 

+ 2 - 2
lift-stateless/src/main/scala/Boot.scala

@@ -27,14 +27,14 @@ class Boot {
     lib.DbBenchmark.init()
 
     // wrap the request in db
-    S.addAround( new LoanWrapper {
+/*    S.addAround( new LoanWrapper {
       def apply[T](f: => T): T = {
         code.db.DB.exec {
           f
         }
       }
     })
-
+*/
     sys.addShutdownHook {
       code.Main.server.stop() // jetty server isn't smart enough to stop itself on sigterm
     }