=per #18708 only try further constructors if constructor can't be found
* Any exception in a read journal's constructor can now be propagated to the caller correctly without being shadowed.
This commit is contained in:
parent
aad2c4ca35
commit
0b0a86df54
1 changed files with 6 additions and 3 deletions
|
|
@ -78,9 +78,12 @@ class PersistenceQuery(system: ExtendedActorSystem) extends Extension {
|
|||
log.debug(s"Create plugin: ${configPath} ${pluginClassName}")
|
||||
val pluginClass = system.dynamicAccess.getClassFor[AnyRef](pluginClassName).get
|
||||
|
||||
system.dynamicAccess.createInstanceFor[ReadJournalProvider](pluginClass, (classOf[ExtendedActorSystem], system) :: (classOf[Config], pluginConfig) :: Nil)
|
||||
.orElse(system.dynamicAccess.createInstanceFor[ReadJournalProvider](pluginClass, (classOf[ExtendedActorSystem], system) :: Nil))
|
||||
.orElse(system.dynamicAccess.createInstanceFor[ReadJournalProvider](pluginClass, Nil))
|
||||
def instantiate(args: collection.immutable.Seq[(Class[_], AnyRef)]) =
|
||||
system.dynamicAccess.createInstanceFor[ReadJournalProvider](pluginClass, args)
|
||||
|
||||
instantiate((classOf[ExtendedActorSystem], system) :: (classOf[Config], pluginConfig) :: Nil)
|
||||
.recoverWith { case x: NoSuchMethodException ⇒ instantiate((classOf[ExtendedActorSystem], system) :: Nil) }
|
||||
.recoverWith { case x: NoSuchMethodException ⇒ instantiate(Nil) }
|
||||
.recoverWith {
|
||||
case ex: Exception ⇒ Failure.apply(new IllegalArgumentException(s"Unable to create read journal plugin instance for path [$configPath], class [$pluginClassName]!", ex))
|
||||
}.get
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue