aboutsummaryrefslogtreecommitdiffstats
path: root/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2022-01-25 14:17:58 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2022-01-25 14:17:58 +0100
commitd7616adac5ab388192acfea71625296295909ee2 (patch)
treeb9102dfc911e90f28a20e9245ddcad5509f1f7b6 /container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
parent144216ecb6712be44fb1dce5ab637159750bc9b3 (diff)
Redesign ComponentDeconstructor to start deconstruction immediately
There is no need to wait with deconstruction after new generation as the container knows when an old graph can be safely GCed. Add shutdown() that waits for all previous graphs to complete deconstruction.
Diffstat (limited to 'container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java')
-rw-r--r--container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
index 0a7d3f45e82..579275deb0f 100644
--- a/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
+++ b/container-disc/src/test/java/com/yahoo/container/jdisc/component/DeconstructorTest.java
@@ -9,7 +9,6 @@ import com.yahoo.jdisc.SharedResource;
import org.junit.Before;
import org.junit.Test;
-import java.time.Duration;
import java.time.Instant;
import java.util.List;
import java.util.function.Supplier;
@@ -26,15 +25,16 @@ public class DeconstructorTest {
@Before
public void init() {
- deconstructor = new Deconstructor(Deconstructor.Mode.RECONFIG, Duration.ZERO);
+ deconstructor = new Deconstructor();
}
@Test
- public void deconstruct_is_synchronous_in_shutdown_mode() {
- deconstructor = new Deconstructor(Deconstructor.Mode.SHUTDOWN);
+ public void deconstructor_waits_for_completion_on_shutdown() {
+ deconstructor = new Deconstructor();
var slowDeconstructComponent = new SlowDeconstructComponent();
deconstructor.deconstruct(List.of(slowDeconstructComponent), emptyList());
+ deconstructor.shutdown();
assertTrue(slowDeconstructComponent.destructed);
}