Marked FailureDetectorLoader as akka private

- also added scaladoc
This commit is contained in:
Endre Sándor Varga 2013-05-17 17:31:30 +02:00
parent fd4bc09035
commit d094e1bf7f

View file

@ -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)
}