Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

renaming and cleaning

  • Loading branch information...
commit 709d878efda7addcda65a564878c42aafccbe722 1 parent d2bbafa
Sadache authored
View
2  framework/project/Build.scala
@@ -485,7 +485,7 @@ object PlayBuild extends Build {
"com.novocode" % "junit-interface" % "0.8" % "test",
"org.fluentlenium" % "fluentlenium-festassert" % "0.7.3" % "test",
- "org.scala-lang" % "scala-compiler" % "2.10.0-M7"
+ "org.scala-lang" % "scala-compiler" % "2.10.0-RC1"
)
val link = Seq(
View
26 framework/src/play/src/main/scala/play/api/libs/concurrent/Promise.scala
@@ -12,7 +12,7 @@ import scala.collection.mutable.Builder
import scala.collection._
import scala.collection.generic.CanBuildFrom
import java.util.concurrent.TimeoutException
-import play.core.Execution.playInternalContext
+import play.core.Execution.internalContext
/**
* The state of a promise; it's waiting, contains a value, or contains an exception.
@@ -160,13 +160,13 @@ class PlayPromise[+A](fu: scala.concurrent.Future[A]) {
if (!iRedeemed) {
v match {
case Redeemed(a) =>
- p.redeem(Left(a))(playInternalContext)
+ p.redeem(Left(a))(internalContext)
case Thrown(e) =>
p.throwing(e)
}
}
}
- }(playInternalContext)
+ }(internalContext)
other.extend1 { v =>
if (!ref.single()) {
val iRedeemed = ref.single.getAndTransform(_ => true)
@@ -174,13 +174,13 @@ class PlayPromise[+A](fu: scala.concurrent.Future[A]) {
if (!iRedeemed) {
v match {
case Redeemed(a) =>
- p.redeem(Right(a))(playInternalContext)
+ p.redeem(Right(a))(internalContext)
case Thrown(e) =>
p.throwing(e)
}
}
}
- }(playInternalContext)
+ }(internalContext)
p.future
}
@@ -205,7 +205,7 @@ class PlayPromise[+A](fu: scala.concurrent.Future[A]) {
* @return either the timer message or the current promise
*/
- def orTimeout[B](message: B): Future[Either[A, B]] = orTimeout(message, Promise.defaultTimeout)(playInternalContext)
+ def orTimeout[B](message: B): Future[Either[A, B]] = orTimeout(message, Promise.defaultTimeout)(internalContext)
/**
* Creates a timer promise with Throwable e (using the deafult Promise timeout).
@@ -213,7 +213,7 @@ class PlayPromise[+A](fu: scala.concurrent.Future[A]) {
* @param e exception to be thrown
* @return a Promise which may throw an exception
*/
- def orTimeout(e: Throwable): Future[A] = orTimeout(e, Promise.defaultTimeout)(playInternalContext).map(_.fold(a => a, e => throw e))(playInternalContext)
+ def orTimeout(e: Throwable): Future[A] = orTimeout(e, Promise.defaultTimeout)(internalContext).map(_.fold(a => a, e => throw e))(internalContext)
}
@@ -311,7 +311,7 @@ object Promise {
* @return a timer promise
*/
def timeout: Future[Nothing] = {
- timeout(throw new TimeoutException("Timeout in promise"), Promise.defaultTimeout, unit = TimeUnit.MILLISECONDS)(playInternalContext)
+ timeout(throw new TimeoutException("Timeout in promise"), Promise.defaultTimeout, unit = TimeUnit.MILLISECONDS)(internalContext)
}
/**
@@ -324,7 +324,7 @@ object Promise {
* lists.
*/
def sequence[A](in: Option[Future[A]]): Future[Option[A]] = {
- implicit val internalContext = play.core.Execution.playInternalContext
+ implicit val internalContext = play.core.Execution.internalContext
in.map { p => p.map { v => Some(v) } }.getOrElse { Promise.pure(None) }
}
@@ -336,7 +336,7 @@ object Promise {
* @return a Promise that's the result of the transformation
*/
def sequence[B, M[_]](in: M[Future[B]])(implicit toTraversableLike: M[Future[B]] => TraversableLike[Future[B], M[Future[B]]], cbf: CanBuildFrom[M[Future[B]], B, M[B]]): Future[M[B]] = {
- toTraversableLike(in).foldLeft(Promise.pure(cbf(in)))((fr, fa: Future[B]) => fr.flatMap(r => fa.map(a => r += a)(playInternalContext))(playInternalContext)).map(_.result)(playInternalContext)
+ toTraversableLike(in).foldLeft(Promise.pure(cbf(in)))((fr, fa: Future[B]) => fr.flatMap(r => fa.map(a => r += a)(internalContext))(internalContext)).map(_.result)(internalContext)
}
/**
@@ -345,16 +345,16 @@ object Promise {
* @param either A or Future[B]
* @return a promise with Either[A,B]
*/
- def sequenceEither[A, B](e: Either[A, Future[B]]): Future[Either[A, B]] = e.fold(r => Promise.pure(Left(r)), _.map(Right(_))(playInternalContext))
+ def sequenceEither[A, B](e: Either[A, Future[B]]): Future[Either[A, B]] = e.fold(r => Promise.pure(Left(r)), _.map(Right(_))(internalContext))
/**
* Converts an either containing a Promise on both Left and Right into a Promise
* of an Either with plain (not-in-a-promise) values.
*/
- def sequenceEither1[A, B](e: Either[Future[A], Future[B]]): Future[Either[A, B]] = e.fold(_.map(Left(_))(playInternalContext), _.map(Right(_))(playInternalContext))
+ def sequenceEither1[A, B](e: Either[Future[A], Future[B]]): Future[Either[A, B]] = e.fold(_.map(Left(_))(internalContext), _.map(Right(_))(internalContext))
@deprecated("use sequence instead", "2.1")
- def sequenceOption[A](o: Option[Future[A]]): Future[Option[A]] = o.map(_.map(Some(_))(playInternalContext)).getOrElse(Promise.pure(None))
+ def sequenceOption[A](o: Option[Future[A]]): Future[Option[A]] = o.map(_.map(Some(_))(internalContext)).getOrElse(Promise.pure(None))
}
View
12 framework/src/play/src/main/scala/play/api/libs/concurrent/execution/package.scala
@@ -1,9 +1,7 @@
-package play.api.libs.concurrent.execution {
+package play.api.libs.concurrent.execution
- object `package` {
-
- lazy val defaultContext1: scala.concurrent.ExecutionContext =
- scala.concurrent.ExecutionContext.Implicits.global: scala.concurrent.ExecutionContext //FIXME use a proper ThreadPool for Play from Conf
-
- }
+object Implicits {
+ implicit lazy val defaultContext: scala.concurrent.ExecutionContext =
+ scala.concurrent.ExecutionContext.Implicits.global: scala.concurrent.ExecutionContext //FIXME use a proper ThreadPool for Play from Conf
}
+
View
10 framework/src/play/src/main/scala/play/api/libs/openid/OpenID.scala
@@ -12,7 +12,7 @@ import play.api.libs.ws._
import xml.Node
//TODO do not use Play's internal execution context in libs
-import play.core.Execution.playInternalContext
+import play.core.Execution.internalContext
case class OpenIDServer(url: String, delegate: Option[String])
@@ -84,7 +84,7 @@ private[openid] class OpenIDClient(ws: String => WSRequestHolder) {
) ++ axParameters(axRequired, axOptional) ++ realm.map("openid.realm" -> _).toList
val separator = if (server.url.contains("?")) "&" else "?"
server.url + separator + parameters.map(pair => pair._1 + "=" + URLEncoder.encode(pair._2, "UTF-8")).mkString("&")
- })(playInternalContext)
+ })(internalContext)
}
/**
@@ -106,7 +106,7 @@ private[openid] class OpenIDClient(ws: String => WSRequestHolder) {
case (Some("id_res"), Some(id)) => {
// MUST perform discovery on the claimedId to resolve the op_endpoint.
val server: Future[OpenIDServer] = discovery.discoverServer(id)
- server.flatMap(directVerification(queryString))(playInternalContext)
+ server.flatMap(directVerification(queryString))(internalContext)
}
case (Some("cancel"), _) => PurePromise(throw Errors.AUTH_CANCEL)
case _ => PurePromise(throw Errors.BAD_RESPONSE)
@@ -122,7 +122,7 @@ private[openid] class OpenIDClient(ws: String => WSRequestHolder) {
if (response.status == 200 && response.body.contains("is_valid:true")) {
UserInfo(queryString)
} else throw Errors.AUTH_ERROR
- })(playInternalContext)
+ })(internalContext)
}
private def axParameters(axRequired: Seq[(String, String)],
@@ -184,7 +184,7 @@ private[openid] class Discovery(ws: (String) => WSRequestHolder) {
ws(discoveryUrl).get().map(response => {
val maybeOpenIdServer = new XrdsResolver().resolve(response) orElse new HtmlResolver().resolve(response)
maybeOpenIdServer.getOrElse(throw Errors.NETWORK_ERROR)
- })(playInternalContext)
+ })(internalContext)
}
}
View
22 framework/src/play/src/main/scala/play/api/mvc/Results.scala
@@ -10,7 +10,7 @@ import play.api.http.HeaderNames._
import scala.concurrent.{ Future, ExecutionContext }
-import play.core.Execution.playInternalContext
+import play.core.Execution.internalContext
/**
* A simple HTTP response header, used for standard responses.
@@ -376,7 +376,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
def unflatten:Future[PlainResult] = result.flatMap {
case r:PlainResult => Promise.pure(r)
case r@AsyncResult(_) => r.unflatten
- }(playInternalContext)
+ }(internalContext)
def map(f: Result => Result)(implicit ec: ExecutionContext): AsyncResult = AsyncResult(result.map(f))
@@ -392,7 +392,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def withHeaders(headers: (String, String)*): AsyncResult = {
- map(_.withHeaders(headers: _*))(playInternalContext)
+ map(_.withHeaders(headers: _*))(internalContext)
}
/**
@@ -407,7 +407,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def withCookies(cookies: Cookie*): AsyncResult = {
- map(_.withCookies(cookies: _*))(playInternalContext)
+ map(_.withCookies(cookies: _*))(internalContext)
}
/**
@@ -422,7 +422,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def discardingCookies(cookies: DiscardingCookie*): AsyncResult = {
- map(_.discardingCookies(cookies: _*))(playInternalContext)
+ map(_.discardingCookies(cookies: _*))(internalContext)
}
/**
@@ -437,7 +437,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def withSession(session: Session): AsyncResult = {
- map(_.withSession(session))(playInternalContext)
+ map(_.withSession(session))(internalContext)
}
/**
@@ -452,7 +452,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def withSession(session: (String, String)*): AsyncResult = {
- map(_.withSession(session: _*))(playInternalContext)
+ map(_.withSession(session: _*))(internalContext)
}
/**
@@ -466,7 +466,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def withNewSession: AsyncResult = {
- map(_.withNewSession)(playInternalContext)
+ map(_.withNewSession)(internalContext)
}
/**
@@ -481,7 +481,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def flashing(flash: Flash): AsyncResult = {
- map(_.flashing(flash))(playInternalContext)
+ map(_.flashing(flash))(internalContext)
}
/**
@@ -496,7 +496,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def flashing(values: (String, String)*): AsyncResult = {
- map(_.flashing(values: _*))(playInternalContext)
+ map(_.flashing(values: _*))(internalContext)
}
/**
@@ -511,7 +511,7 @@ case class AsyncResult(result: Future[Result]) extends Result with WithHeaders[A
* @return the new result
*/
def as(contentType: String): AsyncResult = {
- map(_.as(contentType))(playInternalContext)
+ map(_.as(contentType))(internalContext)
}
}
View
6 framework/src/play/src/main/scala/play/api/mvc/WebSocket.scala
@@ -5,7 +5,7 @@ import play.api.libs.iteratee._
import play.api.libs.concurrent._
import scala.concurrent.Future
-import play.core.Execution.playInternalContext
+import play.core.Execution.internalContext
/**
* A WebSocket handler.
@@ -87,8 +87,8 @@ object WebSocket {
def async[A](f: RequestHeader => Future[(Iteratee[A, _], Enumerator[A])])(implicit frameFormatter: FrameFormatter[A]): WebSocket[A] = {
using { rh =>
val p = f(rh)
- val it = Iteratee.flatten(p.map(_._1)(playInternalContext))
- val enum = Enumerator.flatten(p.map(_._2)(playInternalContext))
+ val it = Iteratee.flatten(p.map(_._1)(internalContext))
+ val enum = Enumerator.flatten(p.map(_._2)(internalContext))
(it, enum)
}
}
View
6 framework/src/play/src/main/scala/play/core/j/JavaPromise.scala
@@ -10,7 +10,7 @@ import java.util.concurrent.{ TimeUnit, Callable }
import scala.concurrent.{ Future, ExecutionContext }
-import play.core.Execution.playInternalContext
+import play.core.Execution.internalContext
object JavaPromise {
@@ -25,11 +25,11 @@ object JavaPromise {
def sequence[A](promises: JList[F.Promise[_ <: A]]): Future[JList[A]] = {
Promise.sequence(JavaConverters.asScalaBufferConverter(promises).asScala.map(_.getWrappedPromise))
- .map(az => JavaConverters.bufferAsJavaListConverter(az).asJava)(playInternalContext)
+ .map(az => JavaConverters.bufferAsJavaListConverter(az).asJava)(internalContext)
}
def timeout[A](message: A, delay: Long, unit: java.util.concurrent.TimeUnit) = {
- Promise.timeout(message, delay, unit)(playInternalContext)
+ Promise.timeout(message, delay, unit)(internalContext)
}
def timeout: Future[Nothing] = Promise.timeout
View
2  framework/src/play/src/main/scala/play/core/j/JavaResults.scala
@@ -72,7 +72,7 @@ object JavaResultExtractor {
case r: AsyncResult => getBody(new ResultWrapper(r.result.await.get))
case r @ SimpleResult(_, bodyEnumerator) => {
var readAsBytes = Enumeratee.map[r.BODY_CONTENT](r.writeable.transform(_)).transform(Iteratee.consume[Array[Byte]]())
- bodyEnumerator(readAsBytes).flatMap(_.run)(play.core.Execution.playInternalContext).value1.get
+ bodyEnumerator(readAsBytes).flatMap(_.run)(play.core.Execution.internalContext).value1.get
}
}
View
4 framework/src/play/src/main/scala/play/core/server/netty/PlayDefaultUpstreamHandler.scala
@@ -28,7 +28,7 @@ import scala.collection.JavaConverters._
private[server] class PlayDefaultUpstreamHandler(server: Server, allChannels: DefaultChannelGroup) extends SimpleChannelUpstreamHandler with Helpers with WebSocketHandler with RequestBodyHandler {
- implicit val internalExecutionContext = play.core.Execution.playInternalContext
+ implicit val internalExecutionContext = play.core.Execution.internalContext
private val requestIDs = new java.util.concurrent.atomic.AtomicLong(0)
@@ -326,7 +326,7 @@ private[server] class PlayDefaultUpstreamHandler(server: Server, allChannels: De
val filteredAction = app.map(_.global).getOrElse(DefaultGlobal).doFilter(a)
- val eventuallyBodyParser = scala.concurrent.Future(filteredAction(requestHeader))//TODO (someUserConfigurableExecutionContext)
+ val eventuallyBodyParser = scala.concurrent.Future(filteredAction(requestHeader))(play.api.libs.concurrent.execution.Implicits.defaultContext)
requestHeader.headers.get("Expect").filter(_ == "100-continue").foreach { _ =>
eventuallyBodyParser.flatMap(_.unflatten).map {
View
2  framework/src/play/src/main/scala/play/core/server/netty/RequestBodyHandler.scala
@@ -25,7 +25,7 @@ import scala.collection.JavaConverters._
private[server] trait RequestBodyHandler {
def newRequestBodyHandler[R](firstIteratee: Future[Iteratee[Array[Byte], Result]], allChannels: DefaultChannelGroup, server: Server): (Future[Iteratee[Array[Byte], Result]], SimpleChannelUpstreamHandler) = {
- implicit val internalContext = play.core.Execution.playInternalContext
+ implicit val internalContext = play.core.Execution.internalContext
import scala.concurrent.stm._
val redeemed = Ref(false)
var p = Promise[Iteratee[Array[Byte], Result]]()
View
2  framework/src/play/src/main/scala/play/core/system/Execution.scala
@@ -3,7 +3,7 @@ package play.core
object Execution {
- lazy val playInternalContext: scala.concurrent.ExecutionContext =
+ lazy val internalContext: scala.concurrent.ExecutionContext =
@julienrf Collaborator
julienrf added a note

Why not make this one private[core]?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
scala.concurrent.ExecutionContext.Implicits.global: scala.concurrent.ExecutionContext //FIXME use a proper ThreadPool for Play from Conf
}
Please sign in to comment.
Something went wrong with that request. Please try again.