Removing akka.util.NonFatal and replacing it with scala.util.control.NonFatal
This commit is contained in:
parent
8095607982
commit
1261fab3af
27 changed files with 54 additions and 73 deletions
|
|
@ -13,7 +13,7 @@ import akka.testkit.AkkaSpec
|
|||
import akka.testkit.DefaultTimeout
|
||||
import akka.pattern.ask
|
||||
import scala.concurrent.util.duration._
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
object SupervisorMiscSpec {
|
||||
val config = """
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ import java.io.{ NotSerializableException, ObjectOutputStream }
|
|||
import akka.serialization.SerializationExtension
|
||||
import akka.event.Logging.LogEventException
|
||||
import scala.collection.immutable.{ TreeSet, TreeMap }
|
||||
import akka.util.{ Unsafe, Helpers, NonFatal }
|
||||
import akka.util.{ Unsafe, Helpers }
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.util.Duration
|
||||
|
||||
//TODO: everything here for current compatibility - could be limited more
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ package akka.actor
|
|||
import akka.dispatch._
|
||||
import akka.routing._
|
||||
import akka.event._
|
||||
import akka.util.{ NonFatal, Switch, Helpers }
|
||||
import akka.util.{ Switch, Helpers }
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.{ Future, Promise }
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import scala.annotation.tailrec
|
|||
import scala.concurrent.util.Duration
|
||||
import java.io.Closeable
|
||||
import scala.concurrent.{ Await, Awaitable, CanAwait, Future }
|
||||
import scala.util.control.NonFatal
|
||||
import akka.util._
|
||||
import akka.util.internal.{ HashedWheelTimer, ConcurrentIdentityHashMap }
|
||||
import java.util.concurrent.{ ThreadFactory, CountDownLatch, TimeoutException, RejectedExecutionException }
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
package akka.actor
|
||||
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import scala.reflect.ClassTag
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import language.postfixOps
|
|||
|
||||
import scala.concurrent.{ ExecutionContext, Future }
|
||||
import scala.concurrent.util.Duration
|
||||
import akka.util.{ ByteString, NonFatal }
|
||||
import scala.util.control.NonFatal
|
||||
import akka.util.ByteString
|
||||
import java.net.{ SocketAddress, InetSocketAddress }
|
||||
import java.io.IOException
|
||||
import java.nio.ByteBuffer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import language.existentials
|
|||
|
||||
import akka.japi.{ Creator, Option ⇒ JOption }
|
||||
import java.lang.reflect.{ InvocationTargetException, Method, InvocationHandler, Proxy }
|
||||
import akka.util.{ Timeout, NonFatal }
|
||||
import akka.util.Timeout
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.concurrent.{ Await, Future }
|
||||
import akka.util.Reflect.instantiator
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ package akka.dispatch
|
|||
import java.util.concurrent._
|
||||
import akka.event.Logging.{ Error, LogEventException }
|
||||
import akka.actor._
|
||||
import scala.annotation.tailrec
|
||||
import akka.event.EventStream
|
||||
import com.typesafe.config.Config
|
||||
import akka.serialization.SerializationExtension
|
||||
import akka.util.{ Unsafe, Index }
|
||||
import scala.annotation.tailrec
|
||||
import scala.concurrent.forkjoin.{ ForkJoinTask, ForkJoinPool }
|
||||
import akka.util.{ Unsafe, NonFatal, Index }
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.concurrent.ExecutionContext
|
||||
import scala.concurrent.{ Await, Awaitable }
|
||||
import scala.concurrent.{ ExecutionContext, Await, Awaitable }
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
final case class Envelope private (val message: Any, val sender: ActorRef)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
*/
|
||||
package akka.dispatch
|
||||
|
||||
import akka.AkkaException
|
||||
import java.util.{ Comparator, PriorityQueue, Queue, Deque }
|
||||
import scala.concurrent.util.Duration
|
||||
import akka.actor.{ ActorCell, ActorRef, Cell }
|
||||
import akka.util.{ Unsafe, NonFatal, BoundedBlockingQueue }
|
||||
import java.util.concurrent._
|
||||
import annotation.tailrec
|
||||
import akka.AkkaException
|
||||
import akka.actor.{ ActorCell, ActorRef, Cell, ActorSystem, InternalActorRef, DeadLetter }
|
||||
import akka.util.{ Unsafe, BoundedBlockingQueue }
|
||||
import akka.event.Logging.Error
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.annotation.tailrec
|
||||
import scala.util.control.NonFatal
|
||||
import com.typesafe.config.Config
|
||||
import akka.actor._
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
|
|
|
|||
|
|
@ -6,11 +6,12 @@ package akka.pattern
|
|||
import language.implicitConversions
|
||||
|
||||
import java.util.concurrent.TimeoutException
|
||||
import annotation.tailrec
|
||||
import akka.actor._
|
||||
import akka.dispatch._
|
||||
import scala.annotation.tailrec
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.{ Future, Promise, ExecutionContext }
|
||||
import akka.util.{ NonFatal, Timeout, Unsafe }
|
||||
import akka.util.{ Timeout, Unsafe }
|
||||
|
||||
/**
|
||||
* This is what is used to complete a Future that is returned from an ask/? call,
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ package akka.pattern
|
|||
import java.util.concurrent.atomic.{ AtomicInteger, AtomicLong, AtomicBoolean }
|
||||
import akka.AkkaException
|
||||
import akka.actor.Scheduler
|
||||
import akka.util.{ NonFatal, Unsafe }
|
||||
import akka.util.Unsafe
|
||||
import scala.util.control.NoStackTrace
|
||||
import java.util.concurrent.{ Callable, CopyOnWriteArrayList }
|
||||
import scala.concurrent.{ ExecutionContext, Future, Promise, Await }
|
||||
import scala.concurrent.util.{ Duration, Deadline }
|
||||
import scala.concurrent.util.duration._
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
/**
|
||||
* Companion object providing factory methods for Circuit Breaker which runs callbacks in caller's thread
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package akka.pattern
|
|||
import scala.concurrent.util.Duration
|
||||
import scala.concurrent.{ ExecutionContext, Promise, Future }
|
||||
import akka.actor._
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
trait FutureTimeoutSupport {
|
||||
/**
|
||||
|
|
@ -15,13 +15,11 @@ trait FutureTimeoutSupport {
|
|||
* after the specified duration.
|
||||
*/
|
||||
def after[T](duration: Duration, using: Scheduler)(value: ⇒ Future[T])(implicit ec: ExecutionContext): Future[T] =
|
||||
if (duration.isFinite() && duration.length < 1) value else {
|
||||
if (duration.isFinite() && duration.length < 1) {
|
||||
try value catch { case NonFatal(t) ⇒ Future.failed(t) }
|
||||
} else {
|
||||
val p = Promise[T]()
|
||||
val c = using.scheduleOnce(duration) {
|
||||
p completeWith { try value catch { case NonFatal(t) ⇒ Future.failed(t) } }
|
||||
}
|
||||
val f = p.future
|
||||
f onComplete { _ ⇒ c.cancel() }
|
||||
f
|
||||
using.scheduleOnce(duration) { p completeWith { try value catch { case NonFatal(t) ⇒ Future.failed(t) } } }
|
||||
p.future
|
||||
}
|
||||
}
|
||||
|
|
@ -10,7 +10,7 @@ import com.typesafe.config.Config
|
|||
import akka.actor.{ Extension, ExtendedActorSystem, Address, DynamicAccess }
|
||||
import akka.event.Logging
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
import scala.collection.mutable.ArrayBuffer
|
||||
import java.io.NotSerializableException
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
/**
|
||||
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.util
|
||||
|
||||
/**
|
||||
* Extractor of non-fatal Throwables. Will not match fatal errors
|
||||
* like VirtualMachineError (OutOfMemoryError)
|
||||
* ThreadDeath, LinkageError and InterruptedException.
|
||||
* StackOverflowError is matched, i.e. considered non-fatal.
|
||||
*
|
||||
* Usage to catch all harmless throwables:
|
||||
* {{{
|
||||
* try {
|
||||
* // dangerous stuff
|
||||
* } catch {
|
||||
* case NonFatal(e) => log.error(e, "Something not that bad")
|
||||
* }
|
||||
* }}}
|
||||
*/
|
||||
object NonFatal {
|
||||
def unapply(t: Throwable): Option[Throwable] = t match {
|
||||
case e: StackOverflowError ⇒ Some(e) // StackOverflowError ok even though it is a VirtualMachineError
|
||||
// VirtualMachineError includes OutOfMemoryError and other fatal errors
|
||||
case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError ⇒ None
|
||||
case e ⇒ Some(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com>
|
||||
*/
|
||||
package akka.util
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
/**
|
||||
* Collection of internal reflection utilities which may or may not be
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import org.apache.camel.impl.DefaultCamelContext
|
|||
import scala.Predef._
|
||||
import akka.event.Logging
|
||||
import akka.camel.Camel
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.util.Duration
|
||||
import org.apache.camel.{ ProducerTemplate, CamelContext }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import org.apache.camel.processor.SendProcessor
|
|||
import akka.actor.{ Props, ActorRef, Terminated, Actor }
|
||||
import org.apache.camel.Endpoint
|
||||
import akka.camel._
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
/**
|
||||
* Watches the end of life of <code>Producer</code>s.
|
||||
|
|
|
|||
|
|
@ -17,9 +17,10 @@ import akka.pattern._
|
|||
import scala.reflect.BeanProperty
|
||||
import scala.concurrent.util.duration._
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.util.control.NonFatal
|
||||
import java.util.concurrent.{ TimeoutException, CountDownLatch }
|
||||
import akka.camel.internal.CamelExchangeAdapter
|
||||
import akka.util.{ NonFatal, Timeout }
|
||||
import akka.util.Timeout
|
||||
import akka.camel.{ ActorNotRegisteredException, ConsumerConfig, Camel, Ack, FailureResult, CamelMessage }
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import scala.concurrent.Future
|
|||
import akka.testkit.AkkaSpec
|
||||
import akka.testkit.DefaultTimeout
|
||||
import akka.testkit.ImplicitSender
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
object TestkitDocSpec {
|
||||
case object Say42
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import akka.event.Logging
|
|||
import com.typesafe.config.Config
|
||||
import akka.ConfigurationException
|
||||
import akka.dispatch._
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
import akka.pattern.{ CircuitBreakerOpenException, CircuitBreaker }
|
||||
import scala.concurrent.util.Duration
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import java.io._
|
|||
import java.nio.{ ByteBuffer, ByteOrder }
|
||||
import java.nio.channels.FileChannel
|
||||
import akka.event.LoggingAdapter
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
// returned from journal replay
|
||||
sealed trait JournalItem
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@ import language.implicitConversions
|
|||
import java.net.InetSocketAddress
|
||||
import com.typesafe.config.{ ConfigObject, ConfigFactory, Config }
|
||||
import akka.actor.{ RootActorPath, ActorPath, ActorSystem, ExtendedActorSystem }
|
||||
import scala.concurrent.{ Await, Awaitable }
|
||||
import akka.util.{ Timeout, NonFatal }
|
||||
import akka.util.Timeout
|
||||
import akka.remote.testconductor.{ TestConductorExt, TestConductor, RoleName }
|
||||
import akka.remote.RemoteActorRefProvider
|
||||
import akka.testkit.AkkaSpec
|
||||
import scala.concurrent.{ Await, Awaitable }
|
||||
import scala.util.control.NonFatal
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.concurrent.util.duration._
|
||||
import akka.remote.RemoteActorRefProvider
|
||||
|
||||
/**
|
||||
* Configure the role names and participants of the test, including configuration settings.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ import akka.remote.{ RemoteProtocol, RemoteMessage, RemoteLifeCycleEvent, Remote
|
|||
import akka.AkkaException
|
||||
import akka.event.Logging
|
||||
import akka.actor.{ DeadLetter, Address, ActorRef }
|
||||
import akka.util.{ NonFatal, Switch }
|
||||
import akka.util.Switch
|
||||
import scala.util.control.NonFatal
|
||||
import org.jboss.netty.handler.ssl.SslHandler
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import org.jboss.netty.util.{ DefaultObjectSizeEstimator, HashedWheelTimer }
|
|||
import akka.event.Logging
|
||||
import akka.remote.RemoteProtocol.AkkaRemoteProtocol
|
||||
import akka.remote.{ RemoteTransportException, RemoteTransport, RemoteActorRefProvider, RemoteActorRef, RemoteServerStarted }
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
import akka.actor.{ ExtendedActorSystem, Address, ActorRef }
|
||||
import com.google.protobuf.MessageLite
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,13 @@ import java.util.LinkedList
|
|||
import scala.annotation.tailrec
|
||||
import com.typesafe.config.Config
|
||||
import akka.actor.{ ActorInitializationException, ExtensionIdProvider, ExtensionId, Extension, ExtendedActorSystem, ActorRef, ActorCell }
|
||||
import akka.dispatch.{ MailboxType, TaskInvocation, SystemMessage, Suspend, Resume, MessageDispatcherConfigurator, MessageDispatcher, Mailbox, Envelope, DispatcherPrerequisites, DefaultSystemMessageQueue }
|
||||
import akka.dispatch.{ MessageQueue, MailboxType, TaskInvocation, SystemMessage, Suspend, Resume, MessageDispatcherConfigurator, MessageDispatcher, Mailbox, Envelope, DispatcherPrerequisites, DefaultSystemMessageQueue }
|
||||
import scala.concurrent.util.duration.intToDurationInt
|
||||
import akka.util.{ Switch, NonFatal }
|
||||
import akka.util.Switch
|
||||
import scala.concurrent.util.Duration
|
||||
import scala.concurrent.Awaitable
|
||||
import akka.actor.ActorContext
|
||||
import akka.dispatch.MessageQueue
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
/*
|
||||
* Locking rules:
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ import scala.concurrent.stm._
|
|||
import scala.util.Random.{ nextInt ⇒ random }
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import akka.pattern.{ AskTimeoutException, ask }
|
||||
import akka.util.{ NonFatal, Timeout }
|
||||
import akka.util.Timeout
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
object FickleFriends {
|
||||
case class FriendlyIncrement(friends: Seq[ActorRef], timeout: Timeout, latch: CountDownLatch)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import scala.annotation.tailrec
|
|||
import scala.collection.mutable.ListBuffer
|
||||
import akka.event.Logging
|
||||
import java.util.concurrent.TimeUnit
|
||||
import akka.util.NonFatal
|
||||
import scala.util.control.NonFatal
|
||||
|
||||
private[zeromq] object ConcurrentSocketActor {
|
||||
private sealed trait PollMsg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue