aboutsummaryrefslogtreecommitdiffstats
path: root/container-disc/src
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@oath.com>2018-03-22 16:13:37 +0100
committerBjørn Christian Seime <bjorncs@oath.com>2018-03-22 16:13:39 +0100
commit8180ac219054912c074fe54065b9d43f0b9e663a (patch)
tree15bb7a527eca8bbc4bbd7881620e81df171585b1 /container-disc/src
parentbb0908d6d4aeb60ea24171db134e81874e02803c (diff)
Distinguish between different types of "components" in log output
Includes some comments about gotchas as well.
Diffstat (limited to 'container-disc/src')
-rw-r--r--container-disc/src/main/java/com/yahoo/container/jdisc/component/Deconstructor.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/component/Deconstructor.java b/container-disc/src/main/java/com/yahoo/container/jdisc/component/Deconstructor.java
index f13c078c41d..10326227405 100644
--- a/container-disc/src/main/java/com/yahoo/container/jdisc/component/Deconstructor.java
+++ b/container-disc/src/main/java/com/yahoo/container/jdisc/component/Deconstructor.java
@@ -9,7 +9,6 @@ import com.yahoo.jdisc.SharedResource;
import com.yahoo.log.LogLevel;
import java.security.SecureRandom;
-import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -37,20 +36,22 @@ public class Deconstructor implements ComponentDeconstructor {
@Override
public void deconstruct(Object component) {
+ // The mix of deconstructing some components on separate thread and some on caller thread could in theory violate
+ // ordering contraints between components.
if (component instanceof AbstractComponent) {
AbstractComponent abstractComponent = (AbstractComponent) component;
if (abstractComponent.isDeconstructable()) {
executor.schedule(new DestructComponentTask(abstractComponent), delay, TimeUnit.SECONDS);
}
} else if (component instanceof Provider) {
- log.info("Starting deconstruction of " + component);
+ // TODO Providers should most likely be deconstructed similarily to AbstractComponent
+ log.info("Starting deconstruction of provider " + component);
((Provider)component).deconstruct();
- log.info("Finished deconstructing " + component);
+ log.info("Finished deconstructing of provider " + component);
} else if (component instanceof SharedResource) {
+ log.info("Releasing container reference to resource " + component);
// No need to delay release, as jdisc does ref-counting
- log.info("Starting deconstruction of " + component);
((SharedResource)component).release();
- log.info("Finished deconstructing " + component);
}
}
@@ -68,29 +69,29 @@ public class Deconstructor implements ComponentDeconstructor {
}
public void run() {
- log.info("Starting deconstruction of " + component);
+ log.info("Starting deconstruction of component " + component);
try {
component.deconstruct();
- log.info("Finished deconstructing " + component);
+ log.info("Finished deconstructing of component " + component);
}
catch (Exception | NoClassDefFoundError e) { // May get class not found due to it being already unloaded
- log.log(WARNING, "Exception thrown when deconstructing " + component, e);
+ log.log(WARNING, "Exception thrown when deconstructing component " + component, e);
}
catch (Error e) {
try {
// Randomize restart over 10 minutes to avoid simultaneous cluster restarts
long randomSleepSeconds = random() * 60 * 10;
- log.log(LogLevel.FATAL, "Error when deconstructing " + component + ". Will sleep for " +
+ log.log(LogLevel.FATAL, "Error when deconstructing component " + component + ". Will sleep for " +
randomSleepSeconds + " seconds then restart", e);
Thread.sleep(randomSleepSeconds * 1000);
}
catch (InterruptedException exception) {
log.log(WARNING, "Randomized wait before dying disrupted. Dying now.");
}
- com.yahoo.protect.Process.logAndDie("Shutting down due to error when deconstructing " + component);
+ com.yahoo.protect.Process.logAndDie("Shutting down due to error when deconstructing component " + component);
}
catch (Throwable e) {
- log.log(WARNING, "Non-error not exception throwable thrown when deconstructing " + component, e);
+ log.log(WARNING, "Non-error not exception throwable thrown when deconstructing component " + component, e);
}
}
}