diff --git a/akka-remote/src/main/scala/akka/remote/FailureDetectorRegistry.scala b/akka-remote/src/main/scala/akka/remote/FailureDetectorRegistry.scala index 9a8ee8e2b8..da4aa2f8de 100644 --- a/akka-remote/src/main/scala/akka/remote/FailureDetectorRegistry.scala +++ b/akka-remote/src/main/scala/akka/remote/FailureDetectorRegistry.scala @@ -47,8 +47,21 @@ trait FailureDetectorRegistry[A] { def reset(): Unit } -object FailureDetectorLoader { +/** + * Utility class to create [[FailureDetector]] instances reflectively. + */ +private[akka] object FailureDetectorLoader { + /** + * Loads and instantiates a given [[FailureDetector]] implementation. The class to be loaded must have a constructor + * that accepts a [[com.typesafe.config.Config]] and an [[EventStream]] parameter. Will throw ConfigurationException + * if the implementation cannot be loaded. + * + * @param fqcn Fully qualified class name of the implementation to be loaded. + * @param config Configuration that will be passed to the implementation + * @param system ActorSystem to be used for loading the implementation + * @return A configured instance of the given [[FailureDetector]] implementation + */ def load(fqcn: String, config: Config, system: ActorSystem): FailureDetector = { system.asInstanceOf[ExtendedActorSystem].dynamicAccess.createInstanceFor[FailureDetector]( fqcn, List( @@ -59,6 +72,16 @@ object FailureDetectorLoader { }).get } + /** + * Loads and instantiates a given [[FailureDetector]] implementation. The class to be loaded must have a constructor + * that accepts a [[com.typesafe.config.Config]] and an [[EventStream]] parameter. Will throw ConfigurationException + * if the implementation cannot be loaded. Use [[FailureDetectorLoader#load]] if no implicit [[ActorContext]] is + * available. + * + * @param fqcn Fully qualified class name of the implementation to be loaded. + * @param config Configuration that will be passed to the implementation + * @return + */ def apply(fqcn: String, config: Config)(implicit ctx: ActorContext) = load(fqcn, config, ctx.system) }