Merge branch 'master' into wip-1310-err2-patriknw

Conflicts:
	akka-actor/src/main/scala/akka/dispatch/AbstractDispatcher.scala
	akka-cluster/src/main/scala/akka/cluster/Cluster.scala
	akka-cluster/src/main/scala/akka/cluster/TransactionLog.scala
	akka-remote/src/main/scala/akka/remote/netty/NettyRemoteSupport.scala
This commit is contained in:
Patrik Nordwall 2012-02-03 13:57:28 +01:00
commit 09e13e271b
291 changed files with 10322 additions and 10812 deletions

View file

@ -90,6 +90,21 @@ final case class TaskInvocation(eventStream: EventStream, runnable: Runnable, cl
}
}
/**
* Java API to create ExecutionContexts
*/
object ExecutionContexts {
/**
* Creates an ExecutionContext from the given ExecutorService
*/
def fromExecutorService(e: ExecutorService): ExecutionContext = new ExecutionContext.WrappedExecutorService(e)
/**
* Creates an ExecutionContext from the given Executor
*/
def fromExecutor(e: Executor): ExecutionContext = new ExecutionContext.WrappedExecutor(e)
}
object ExecutionContext {
implicit def defaultExecutionContext(implicit system: ActorSystem): ExecutionContext = system.dispatcher
@ -103,14 +118,20 @@ object ExecutionContext {
*/
def fromExecutor(e: Executor): ExecutionContext = new WrappedExecutor(e)
private class WrappedExecutorService(val executor: ExecutorService) extends ExecutorServiceDelegate with ExecutionContext {
/**
* Internal Akka use only
*/
private[akka] class WrappedExecutorService(val executor: ExecutorService) extends ExecutorServiceDelegate with ExecutionContext {
override def reportFailure(t: Throwable): Unit = t match {
case e: LogEventException e.getCause.printStackTrace()
case _ t.printStackTrace()
}
}
private class WrappedExecutor(val executor: Executor) extends Executor with ExecutionContext {
/**
* Internal Akka use only
*/
private[akka] class WrappedExecutor(val executor: Executor) extends Executor with ExecutionContext {
override final def execute(runnable: Runnable): Unit = executor.execute(runnable)
override def reportFailure(t: Throwable): Unit = t match {
case e: LogEventException e.getCause.printStackTrace()