Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace console.log for lift_defaultLogError - Lift 3.0 #1484

Closed
wants to merge 116 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
d065598
First step to a revised 3.0
dpp Feb 12, 2013
7964a6f
First bits of Lift 3.0
dpp Feb 13, 2013
9b77ed6
Added Tag Processing
dpp Feb 13, 2013
f14302a
Snippets processed before Tags
dpp Feb 13, 2013
5943e5d
A helper to remove an attribute from an Elem
dpp Feb 14, 2013
fbdfaf1
Fixed some bugs in the Html5 writing routines
dpp Feb 19, 2013
b49f539
Simply Lift
dpp Feb 19, 2013
0da6e42
Adds \;name for data-name selector. Adds "1 \[href\]" to only apply c…
dpp Feb 19, 2013
20f8450
Removed Scala Actor dependency, added support for Markdown files, aut…
dpp Feb 19, 2013
c5be8c2
Use the "^" character to select the head element.
farmdawgnation Feb 19, 2013
9bd720e
Added JavaScript support and basic Source support
dpp Feb 20, 2013
77b27b1
Removed the autowrap template feature as it broke tests
dpp Feb 20, 2013
0088678
Fix the field() method in LiftScreen that uses an underlying field so…
clessg Jan 27, 2013
9ba47e4
Rename ComputeTransformRules->CanBind, #{computeTransform->apply}
nafg Feb 8, 2013
eb3f8a8
Deprecate S.getHeader in favor of S.getResponseHeader.
Shadowfiend Feb 10, 2013
a20f5c2
fixed compiler error due to missing closing }
fmpwizard Feb 15, 2013
4272b1a
Update internal deprecated uses of getHeaders to getResponseHeaders.
Shadowfiend Feb 22, 2013
549a517
Fix order of deprecation arguments in S.getHeader and S.getHeaders.
Shadowfiend Feb 22, 2013
6184600
set the current version of scala to 2.10.0
fmpwizard Feb 22, 2013
a98a1ea
Update web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
hjast Feb 22, 2013
a6ea0f0
Squashed commit of the following:
dpp Mar 5, 2013
bb0bc7d
Added the SourceInfo stuff and make Mapped source info
dpp Mar 6, 2013
e141b4a
Removed ParseDouble class for 3.0
hjast Mar 7, 2013
82cb18b
Deleted snippet A
hjast Mar 7, 2013
89822dc
Removed SimpleController and moved MVCHelper to package
hjast Mar 7, 2013
849a376
Deleted JX
hjast Mar 7, 2013
c75cd0c
Removing jqueryleft and right
hjast Mar 7, 2013
84bcd60
Removed deprecated method respondAsync
hjast Mar 7, 2013
bc7155b
Added MVCHelper to package
hjast Mar 7, 2013
5dfb91b
Removed SetValueAndFocus deprecated method
hjast Mar 7, 2013
81fd233
Removed >> deprecated method
hjast Mar 7, 2013
2625d49
Removed fixHtml deprecated method
hjast Mar 7, 2013
8807555
Added jx back in
hjast Mar 7, 2013
232352a
Repush to rerun jenkins
hjast Mar 7, 2013
f0731f2
Refactored main lift processing
hjast Mar 8, 2013
3fbcd7d
Removed deprecated methods
hjast Mar 8, 2013
c6fb5c0
Removed vector par for 2.8.x
hjast Mar 8, 2013
520dd1c
Removed binding from the bindingspec
hjast Mar 8, 2013
e771cf8
Added WiringUI to a package
hjast Mar 8, 2013
0d0b490
Added WiringUI
hjast Mar 9, 2013
81d8ed1
Created observable future creation
dpp Mar 14, 2013
292b5e9
Fixed a minor issue
dpp Mar 14, 2013
9a15d2d
Wrap Markdown in surround
dpp Mar 15, 2013
d79343d
Added server round-trips with streams and fun stuff like that
dpp Mar 27, 2013
05f3911
Changed the names of promise stuff
dpp Apr 3, 2013
4dda86d
Added map to Promise
dpp Apr 3, 2013
fa070cb
Fixed a typeo
dpp Apr 3, 2013
70875c9
Does a redirect to home for multiple cometactor pages
dpp Apr 8, 2013
5589437
Better backoff on home page redirect
dpp Apr 15, 2013
5fb1562
Fixed some timing issues with Round Trips
dpp Apr 22, 2013
fa819f2
Made the client actor proxy timeout variable
dpp Apr 24, 2013
73c2297
Added an onChange function to AnyVar
dpp Apr 24, 2013
c24643b
Added withFilter to JValue to avoid Scala's warnings
dpp Apr 25, 2013
9d21b29
No messages after a done or failure
dpp Apr 25, 2013
8591c46
Made a bunch of methods public so they can be used from user-code:
dpp May 1, 2013
ecb40f1
An optimization to flow of control exception
dpp May 1, 2013
794f06c
More flexible with the round trip types to allow for JavaScript to be…
dpp May 2, 2013
15db7ea
Do the right thing when there's a different cookie between the CometA…
dpp May 2, 2013
ddb1723
Avoid a multi-threaded race condition if a session is shut down at th…
dpp May 2, 2013
eb9c7bc
Added an ARM trait to Lift
dpp May 7, 2013
8924a57
Added a helper method to Box
dpp May 7, 2013
39e4e01
improved test for surround template
dpp May 12, 2013
74b7b80
Merge branch 'master' into lift_30
fmpwizard May 13, 2013
b0226e4
Props file when the machine can't resolve its own hostname
dpp May 15, 2013
8c0854e
Upgraded to Rhino 1.7R4
dpp May 21, 2013
2e5e919
Reordered the template loading vs. eager eval of the stuff being surr…
dpp May 22, 2013
741defa
Added the ability to restrict sensitive data from getting logged
dpp May 22, 2013
40d2f9a
Issue #1453: LAFuture.collect crashes when futures are resolved out o…
tuhlmann May 25, 2013
07b9b2a
Pluggable pruning of CometActor PartialUpdate
dpp May 30, 2013
c66519c
Implementation of onEventIf, a version of onEvent guarded by confirm().
farmdawgnation May 14, 2013
0c68be7
Null testing for headers. Closes #1452
dpp May 30, 2013
701ce71
Closes #1455. Finer grained sync
dpp May 30, 2013
2ae54bc
Added the Markdown package
dpp Jun 10, 2013
3f7484d
Fixed a compilation issue
dpp Jun 10, 2013
d60ccab
Deal better with entities
dpp Jun 10, 2013
7a30084
Fix an edge case for HTML5 -> ByteStream
dpp Jun 11, 2013
cda89bc
Added the eat attribute to surround
dpp Jun 13, 2013
5bfb966
Issue #1400 - Add Joda Time support to MongoRecord
eltimn Jun 18, 2013
cfef632
Issue #1349 - Add createdAt function to ObjectIdField
eltimn Jun 19, 2013
80fc44d
Issue #1411 - dirty_? flag in Record and Meta as in Mapper
eltimn Jun 19, 2013
68f1e93
Replaced all uses of MongoId with ObjectIdPk in test code.
eltimn Jun 19, 2013
59dce37
Issue #1348 - Add lifecycle callbacks to MongoMetaRecord.update
eltimn Jun 19, 2013
b29effa
Minor cleanup re PR feedback
eltimn Jun 20, 2013
813e362
Updated mongo-java-driver to v2.11.2
eltimn Jun 25, 2013
7d9012c
Add specs for mock actors.
farmdawgnation Jun 29, 2013
b7b537d
Implement MockSpecializedLiftActor and MockLiftActor.
farmdawgnation Jun 29, 2013
93cd577
Expose the mailbox of a Mock*LiftActor via the messages method.
farmdawgnation Jul 1, 2013
d552f02
Made run-mode auto-detection customisable.
japgolly Jun 24, 2013
a38fe4c
Use test run-mode when running tests from ScalaTest or IDEA.
japgolly Jun 27, 2013
a0ca2d5
Signed contributors.md
japgolly Jun 27, 2013
7195f0e
Split PropertyWithModificationCondition.set() into multiple lines and…
japgolly Jun 28, 2013
3cc58d9
Removed PropertyWithModificationCondition.
japgolly Jul 3, 2013
e43e8bd
Added tests for run-mode property modification.
japgolly Jul 3, 2013
3fc919f
Moved Mailer's inner classes from trait to object.
japgolly Jul 1, 2013
51c76d1
Fixed MailerSpec after moving Mailer inner classes from trait to object.
japgolly Jul 3, 2013
b0bc2a1
withFilter on JValue to rid warnings on for-comprehensions
hedefalk Jul 15, 2013
95cf9a4
fixed timezone spec
hedefalk Jul 17, 2013
97c0ab9
Add ValueSnippets LocParam, generalizes Snippet, LocSnippets, Dispatc…
nafg Feb 20, 2013
c937c60
Simplify Loc.Snippet.apply overload disambiguation
nafg Feb 20, 2013
94a2ac1
More cleanup
nafg May 12, 2013
94782ec
fixed #1250 - HTTP OPTIONS verb support
fmpwizard Jul 26, 2013
e025097
Addressed Matt's comments
fmpwizard Jul 28, 2013
edcaff6
To be consistent I changed a few `def` for `val` and removed two println
fmpwizard Jul 28, 2013
eb58f5d
fixed issue #1456 - Deprecate .is on mapper and fix the one on Record
fmpwizard Jul 28, 2013
9d9c1d4
Removed about a million warnings after deprecating .is from Record an…
fmpwizard Jul 28, 2013
52ba276
Add support for X-Frame-Options
dpp Aug 2, 2013
6f216ec
fixed #1291 - SHtml.ajaxSelect doesn't serialize ampersands (&) corre…
fmpwizard Jul 28, 2013
9677270
fixed #1465 - Lift could annotate type of primaryKeyField as a workar…
fmpwizard Jul 29, 2013
b9e2c9d
fixed #1014 - A new CreatedResponse that takes JSON
fmpwizard Jul 28, 2013
47f40ff
Added support for html5 templates in the test framework
fmpwizard Jul 29, 2013
5da40b6
fixed #1457 - Make LiftRules use the html5 parser by default
fmpwizard Jul 29, 2013
8902124
Fixed failing tests related to now using html5 as the default format
fmpwizard Jul 29, 2013
9285b35
Fixed the ToHeadUsages tests related to using the new html5 parser
fmpwizard Jul 29, 2013
58247b8
Closes #1126. Swallows an inner <a> for Menu.item
dpp Jan 9, 2012
d8d6201
We don't want to use eventually here, as it will keep sending an `Add…
fmpwizard Aug 8, 2013
ce58aff
Fixed #1484 - Replace console.log for lift_defaultLogError - Lift 3.0
fmpwizard Aug 9, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Expand Up @@ -2,7 +2,7 @@ import Dependencies._

organization in ThisBuild := "net.liftweb"

version in ThisBuild := "2.6-SNAPSHOT"
version in ThisBuild := "3.0-SNAPSHOT"

homepage in ThisBuild := Some(url("http://www.liftweb.net"))

Expand All @@ -12,7 +12,9 @@ startYear in ThisBuild := Some(2006)

organizationName in ThisBuild := "WorldWide Conferencing, LLC"

crossScalaVersions in ThisBuild := Seq("2.10.0", "2.9.2", "2.9.1-1", "2.9.1")
scalaVersion in ThisBuild := "2.10.0"

crossScalaVersions in ThisBuild := Seq("2.10.0")

libraryDependencies in ThisBuild <++= scalaVersion {sv => Seq(specs2(sv), scalacheck) }

Expand Down
12 changes: 12 additions & 0 deletions contributors.md
Expand Up @@ -168,3 +168,15 @@ Will Palmeri
### Email: ###
wpalmeri at gmail dot com

### Name: ###
David Barri

### Email: ###
japgolly @@ gmail .. com

### Name: ###
Viktor Hedefalk

### Email: ###
hedefalk @@ gmail .. com

246 changes: 223 additions & 23 deletions core/actor/src/main/scala/net/liftweb/actor/LAFuture.scala
Expand Up @@ -19,15 +19,25 @@ package actor

import common._


/**
* A container that contains a calculated value
* or may contain one in the future
*/
class LAFuture[T] /*extends Future[T]*/ {
class LAFuture[T](val scheduler: LAScheduler) {
private var item: T = _
private var failure: Box[Nothing] = Empty
private var satisfied = false
private var aborted = false
private var toDo: List[T => Unit] = Nil
private var onFailure: List[Box[Nothing] => Unit] = Nil
private var onComplete: List[Box[T] => Unit] = Nil

def this() {
this(LAScheduler)
}

LAFuture.notifyObservers(this)

/**
* Satify the future... perform the calculation
Expand All @@ -39,24 +49,42 @@ class LAFuture[T] /*extends Future[T]*/ {
if (!satisfied && !aborted) {
item = value
satisfied = true
toDo
val ret = toDo
toDo = Nil
onFailure = Nil
onComplete.foreach(f => LAFuture.executeWithObservers(scheduler, () => f(Full(value))))
onComplete = Nil
ret
} else Nil
} finally {
notifyAll()
}
}
funcs.foreach(f => LAScheduler.execute(() => f(value)))
funcs.foreach(f => LAFuture.executeWithObservers(scheduler, () => f(value)))
}

/**
* Complete the Future... with a Box... useful from Helpers.tryo
* @param value
*/
def complete(value: Box[T]): Unit = {
value match {
case Full(v) => satisfy(v)
case x: EmptyBox => fail(x)
}
}

/**
* Get the future value
*/
def get: T = synchronized {
@scala.annotation.tailrec
final def get: T = synchronized {
if (satisfied) item
else if (aborted) throw new AbortedFutureException(failure)
else {
this.wait()
if (satisfied) item
else if (aborted) throw new AbortedFutureException()
else if (aborted) throw new AbortedFutureException(failure)
else get
}
}
Expand All @@ -67,27 +95,46 @@ class LAFuture[T] /*extends Future[T]*/ {
* when the value is satified
*/
def foreach(f: T => Unit) {
val todo = synchronized {
if (satisfied) {
val v = item
() => f(v)
} else {
toDo ::= f
() => ()
}
}
onSuccess(f)
}

todo()
/**
* Map the future over a function
* @param f the function to apply to the future
* @tparam A the type that the function returns
* @return a Future that represents the function applied to the value of the future
*/
def map[A](f: T => A): LAFuture[A] = {
val ret = new LAFuture[A](scheduler)
onComplete(v => ret.complete(v.map(f)))
ret
}

def flatMap[A](f: T => LAFuture[A]): LAFuture[A] = {
val ret = new LAFuture[A](scheduler)
onComplete(v => v match {
case Full(v) => f(v).onComplete(v2 => ret.complete(v2))
case e: EmptyBox => ret.complete(e)
})
ret
}

def filter(f: T => Boolean): LAFuture[T] = {
val ret = new LAFuture[T](scheduler)
onComplete(v => ret.complete(v.filter(f)))
ret
}

def withFilter(f: T => Boolean): LAFuture[T] = filter(f)

/**
* Get the future value or if the value is not
* satisfied after the timeout period, return an
* Empty
*/
def get(timeout: Long): Box[T] = synchronized {
if (satisfied) Full(item)
else if (aborted) Empty
else if (aborted) failure
else {
try {
wait(timeout)
Expand All @@ -113,21 +160,170 @@ class LAFuture[T] /*extends Future[T]*/ {
* Abort the future. It can never be satified
*/
def abort() {
fail(Empty)
}

/**
* Execute the function on success of the future
*
* @param f the function to execute on success.
*/
def onSuccess(f: T => Unit) {
synchronized {
if (satisfied) {LAFuture.executeWithObservers(scheduler, () => f(item))} else
if (!aborted) {
toDo ::= f
}
}
}

/**
* Execute a function on failure
*
* @param f the function to execute. Will receive a Box[Nothing] which may be a Failure if there's exception data
*/
def onFail(f: Box[Nothing] => Unit) {
synchronized {
if (aborted) LAFuture.executeWithObservers(scheduler, () => f(failure)) else
if (!satisfied) {
onFailure ::= f
}
}
}

/**
* A function to execute on completion of the Future, success or failure
*
* @param f the function to execute on completion of the Future
*/
def onComplete(f: Box[T] => Unit) {
synchronized {
if (satisfied) {LAFuture.executeWithObservers(scheduler, () => f(Full(item)))} else
if (aborted) {LAFuture.executeWithObservers(scheduler, () => f(failure))} else
onComplete ::= f
}
}

/**
* If the execution fails, do this
* @param e
*/
def fail(e: Exception) {
fail(Failure(e.getMessage, Full(e), Empty))
}

/**
* If the execution fails as a Box[Nothing], do this
* @param e
*/
def fail(e: Box[Nothing]) {
synchronized {
if (!satisfied && !aborted) {
aborted = true
failure = e
onFailure.foreach(f => LAFuture.executeWithObservers(scheduler, () => f(e)))
onComplete.foreach(f => LAFuture.executeWithObservers(scheduler, () => f(e)))
onComplete = Nil
onFailure = Nil
toDo = Nil

notifyAll()
}
}
}

/**
* Has the future completed?
*/
def complete_? : Boolean = synchronized(satisfied || aborted)
}

/**
* Thrown if an LAFuture is aborted during a get
*/
final class AbortedFutureException() extends Exception("Aborted Future")
final class AbortedFutureException(why: Box[Nothing]) extends Exception("Aborted Future")

object LAFuture {
/**
* Create an LAFuture from a function that
* will be applied on a separate thread. The LAFuture
* is returned immediately and the value may be obtained
* by calling `get`
*
* @param f the function that computes the value of the future
* @tparam T the type
* @return an LAFuture that will yield its value when the value has been computed
*/
def apply[T](f: () => T, scheduler: LAScheduler = LAScheduler): LAFuture[T] = {
val ret = new LAFuture[T](scheduler)
scheduler.execute(() => {
try {
ret.satisfy(f())
} catch {
case e: Exception => ret.fail(e)
}
})
ret
}

/**
* Build a new future with a call-by-name value that returns a type T
* @param f the call-by-name code the defines the future
* @tparam T the type that
* @return
*/
def build[T](f: => T, scheduler: LAScheduler = LAScheduler): LAFuture[T] = {
this.apply(() => f, scheduler)
}

private val threadInfo = new ThreadLocal[List[LAFuture[_] => Unit]]

/**
* Notify all the observers that we created a future.
*
* @param future
*/
private def notifyObservers(future: LAFuture[_]) {
val observers = threadInfo.get()
if (null eq observers) {} else {
observers.foreach(_(future))
}
}

private def executeWithObservers(scheduler: LAScheduler, f: () => Unit) {
val cur = threadInfo.get()
scheduler.execute(() => {
val old = threadInfo.get()
threadInfo.set(cur)
try {
f()
} finally {
threadInfo.set(old)
}
})
}

/**
* Do something when a future is created on this thread. This can be used
* to see if there's any Future activity on a thread and if there is,
* we can do smart things on an observing thread.
*
* @param observation the function to execute on Future creation
* @param toDo the action call-by-name code to execute whi
* @tparam T the type of the value returned by toDo
* @return the value computed by toDo
*/
def observeCreation[T](observation: LAFuture[_] => Unit)(toDo: => T): T = {
val old = threadInfo.get()
threadInfo.set(if (null eq old) List(observation) else observation :: old)
try {
toDo
} finally {
threadInfo.set(old)
}
}


/**
* Collect all the future values into the aggregate future
* The returned future will be satisfied when all the
Expand All @@ -136,18 +332,20 @@ object LAFuture {
def collect[T](future: LAFuture[T]*): LAFuture[List[T]] = {
val sync = new Object
val len = future.length
val vals = new collection.mutable.ArrayBuffer[T](len)
val vals = new collection.mutable.ArrayBuffer[Box[T]](len)
// pad array so inserts at random places are possible
for (i <- 0 to len) { vals.insert(i, Empty) }
var gotCnt = 0
val ret = new LAFuture[List[T]]

future.toList.zipWithIndex.foreach {
case (f, idx) =>
f.foreach {
v => sync.synchronized {
vals.insert(idx, v)
vals.insert(idx, Full(v))
gotCnt += 1
if (gotCnt >= len) {
ret.satisfy(vals.toList)
ret.satisfy(vals.toList.flatten)
}
}
}
Expand All @@ -166,7 +364,9 @@ object LAFuture {
def collectAll[T](future: LAFuture[Box[T]]*): LAFuture[Box[List[T]]] = {
val sync = new Object
val len = future.length
val vals = new collection.mutable.ArrayBuffer[T](len)
val vals = new collection.mutable.ArrayBuffer[Box[T]](len)
// pad array so inserts at random places are possible
for (i <- 0 to len) { vals.insert(i, Empty) }
var gotCnt = 0
val ret = new LAFuture[Box[List[T]]]

Expand All @@ -176,10 +376,10 @@ object LAFuture {
vb => sync.synchronized {
vb match {
case Full(v) => {
vals.insert(idx, v)
vals.insert(idx, Full(v))
gotCnt += 1
if (gotCnt >= len) {
ret.satisfy(Full(vals.toList))
ret.satisfy(Full(vals.toList.flatten))
}
}

Expand Down