This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MDCExecutionContextExecutor(val context: java.util.Map[_, _], val delegate: ExecutionContext) extends ExecutionContextExecutor { | |
def execute(runnable: Runnable) { | |
delegate.execute(new Runnable { | |
def run() { | |
val oldContext = MDC.getCopyOfContextMap | |
setContextMap(context) | |
try { | |
runnable.run() | |
} finally { | |
setContextMap(oldContext) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> import scala.reflect.macros.blackbox.Context | |
import scala.reflect.macros.blackbox.Context | |
scala> def expire_impl(c: Context)(): c.Expr[Unit] = { | |
| c.error(c.enclosingPosition, "has expired") | |
| c.literalUnit | |
| } | |
<console>:10: warning: method literalUnit in trait ExprUtils is deprecated: Use quasiquotes instead | |
c.literalUnit | |
^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package monitoring | |
import java.util.concurrent.TimeUnit | |
import akka.dispatch._ | |
import com.typesafe.config.Config | |
import org.slf4j.MDC | |
import scala.concurrent.ExecutionContext | |
import scala.concurrent.duration.{Duration, FiniteDuration} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A MDC propagating dispatcher. | |
* | |
* This dispatcher propagates the MDC current request context if it's set when it's executed. | |
*/ | |
class MDCPropagatingDispatcher(_configurator: MessageDispatcherConfigurator, | |
id: String, | |
throughput: Int, | |
throughputDeadlineTime: Duration, | |
executorServiceFactoryProvider: ExecutorServiceFactoryProvider, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package server | |
import io.sphere.util.Logging | |
import kamon.Kamon | |
import kamon.trace.TraceContext | |
import org.jboss.netty.channel._ | |
import org.jboss.netty.handler.codec.http.HttpRequest | |
import scala.util.control.NonFatal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tracer.withNewContext("ws", Some("blabla"), autoFinish = true) { | |
log.error("hello1 bla bla") | |
Future { | |
log.error("hello2 bla bla") | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api.libs.concurrent.Execution.Implicits._ | |
import play.api.libs.iteratee.Iteratee | |
import play.api.mvc.MultipartFormData.FilePart | |
import play.api.mvc.{ MultipartFormData, BodyParser, BodyParsers } | |
import scala.collection.mutable.ArrayBuilder | |
case class MaxSizeExceeded(length: Long) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait Nat { | |
type plus[That <: Nat] <: Nat | |
} | |
sealed trait Nat0 extends Nat { | |
type plus[That <: Nat] = That | |
} | |
sealed trait NatN[Prev <: Nat] extends Nat { | |
type plus[That <: Nat] = NatN[Prev#plus[That]] | |
} | |
object Nat { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed trait BoolType { | |
type Not <: BoolType | |
type Or[That <: BoolType] <: BoolType | |
} | |
sealed trait TrueType extends BoolType { | |
override type Not = FalseType | |
override type Or[That <: BoolType] = TrueType | |
} | |
sealed trait FalseType extends BoolType { | |
override type Not = TrueType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class Pyramide(a1: Int, a2: Int, a3: Int, a4: Int) { | |
val sum11 = a1 + a2 | |
val sum12 = a2 + a3 | |
val sum13 = a3 + a4 | |
val sum21 = sum11 + sum12 | |
val sum22 = sum12 + sum13 | |
val sum = sum21 + sum22 | |
override def toString: String = | |
s""" |
OlderNewer