Fix possible NPE in ClusterShardingLeaseSpec (#31161)
Set the test lease after variables have been initialised
This commit is contained in:
parent
3faeffd9b1
commit
16e35f6ea9
1 changed files with 4 additions and 4 deletions
|
|
@ -64,16 +64,16 @@ class TestLease(settings: LeaseSettings, system: ExtendedActorSystem) extends Le
|
||||||
val log = Logging(system, classOf[TestLease])
|
val log = Logging(system, classOf[TestLease])
|
||||||
val probe = TestProbe()(system)
|
val probe = TestProbe()(system)
|
||||||
|
|
||||||
log.info("Creating lease {}", settings)
|
|
||||||
|
|
||||||
TestLeaseExt(system).setTestLease(settings.leaseName, this)
|
|
||||||
|
|
||||||
val initialPromise = Promise[Boolean]()
|
val initialPromise = Promise[Boolean]()
|
||||||
|
|
||||||
private val nextAcquireResult = new AtomicReference[Future[Boolean]](initialPromise.future)
|
private val nextAcquireResult = new AtomicReference[Future[Boolean]](initialPromise.future)
|
||||||
private val nextCheckLeaseResult = new AtomicReference[Boolean](false)
|
private val nextCheckLeaseResult = new AtomicReference[Boolean](false)
|
||||||
private val currentCallBack = new AtomicReference[Option[Throwable] => Unit](_ => ())
|
private val currentCallBack = new AtomicReference[Option[Throwable] => Unit](_ => ())
|
||||||
|
|
||||||
|
log.info("Creating lease {}", settings)
|
||||||
|
|
||||||
|
TestLeaseExt(system).setTestLease(settings.leaseName, this)
|
||||||
|
|
||||||
def setNextAcquireResult(next: Future[Boolean]): Unit =
|
def setNextAcquireResult(next: Future[Boolean]): Unit =
|
||||||
nextAcquireResult.set(next)
|
nextAcquireResult.set(next)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue